Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Planet-D ver. 0.5
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Plts { public string name; public int xCord; public int numberBlts; public string color; } public class Program { bool WBlue = false; public static void Main(string[] args) { Program classProg = new Program (); List<Plts> listPlts = new List<Plts>(); listPlts.Add(new Plts {name = "HRed", xCord = 4, numberBlts = 10, color = "red"}); listPlts.Add(new Plts {name = "HBlue", xCord = 12, numberBlts = 10, color = "blue"}); listPlts.Add(new Plts {name = "net1", xCord = 11, numberBlts = 20, color = "blue"}); listPlts.Add(new Plts {name = "net2", xCord = 5, numberBlts = 20, color = "gray"}); listPlts.Add(new Plts {name = "net3", xCord = 8, numberBlts = 30, color = "gray"}); foreach (Plts llistPlst in listPlts) Console.Write(" | Основа1: " + llistPlst.name); Console.WriteLine(""); classProg.BPlrs(listPlts); classProg.NetPlrs(listPlts); Console.WriteLine(""); foreach (Plts llistPlst in listPlts) Console.Write(" | Основа2: " + llistPlst.name + " и " + llistPlst.numberBlts); Console.WriteLine(""); } public void BPlrs(List<Plts> lb) { Console.WriteLine("Blue "); string str = "blue"; var lBluePlts = from list in lb where list.color == str select list; var lBlueAtk = from list in lb where list.color != str select list; int countBlueBltsFgt = 0;; // TODO: Blue Plts foreach (Plts lBP in lBluePlts) { Console.Write(" | " + lBP.name + " и " + lBP.numberBlts); lBP.numberBlts += 1; countBlueBltsFgt += lBP.numberBlts; } Console.WriteLine("\n countBlueBltsFgt = " + countBlueBltsFgt); foreach (Plts BAtk in lBlueAtk) { Console.Write(" | " + BAtk.name + " и " + BAtk.numberBlts); } Console.WriteLine(" "); } public void NetPlrs(List<Plts> lnet) { string str = "gray"; var netPlts = from list in lnet where list.color == "gray" select list; Console.WriteLine("Gray"); foreach(Plts lNetList in netPlts) { System.Threading.Thread.Sleep(10); Console.Write(" |Net " + lNetList.name); } Console.WriteLine(" "); } } }
run
|
edit
|
history
|
help
0
Second minor int
EX8 Loop_For_While
pared 1
aaa
C# managing ISO 8601 dates and times
nik
Polygon Util
Kopi Ping Menu
Enum.IsDefined
Hareket