public static int MinMaxDifference(SinyakList b) { int min = b[0].Length, max = 0; for (int i = 0; i < b.listSize; i++) { if (b[i].Length > max) { max = b[i].Length; } if (b[i].Length < min) { min = b[i].Length; } } return(max - min); }
public static bool CheckTwins(this SinyakList list) { bool isHere = true; for (int i = 0; i < list.listSize; i++) { for (int j = i; j < list.listSize - 1; j++) { if (list[i] == list[j + 1]) { return(true); } else { isHere = false; } } } return(isHere); }
static void Main(string[] args) { SinyakList q = new SinyakList(5); Console.WriteLine("First init -> "); for (int i = 0; i < q.listSize; i++) { q[i] = Console.ReadLine(); } q = q + "xxx"; Console.WriteLine("------------------------------"); for (int i = 0; i < q.listSize; i++) { Console.WriteLine(q[i]); } Console.WriteLine("------------------------------"); --q; for (int i = 0; i < q.listSize; i++) { Console.WriteLine(q[i]); } SinyakList w = new SinyakList(6); Console.WriteLine("Second init -> "); for (int i = 0; i < w.listSize; i++) { w[i] = Console.ReadLine(); } Console.WriteLine("------------------------------"); if (w != q) { Console.WriteLine("equal"); } else { Console.WriteLine("not equal"); } Console.WriteLine("------------------------------"); q = q * w; for (int i = 0; i < q.listSize; i++) { Console.WriteLine(q[i]); } Console.WriteLine("------------------------------"); SinyakList.Date dateOfCreate = new SinyakList.Date(); SinyakList.Owner owner = new SinyakList.Owner(); dateOfCreate.GetDate(); owner.GetAuthorName(); string testStr = "qWWWWWWWW"; int a = testStr.UpperCount(); Console.WriteLine("----------------------------"); Console.WriteLine(a); Console.WriteLine("----------------------------"); if (q.CheckTwins()) { Console.WriteLine("list consist same elements"); } else { Console.WriteLine("no same elements"); } }
public static int GetSumAndCount(SinyakList list) { return(list.listSize); }