public static void TestGetSize() { string test = "GetSize"; Console.WriteLine("Now testing GetSize"); try { int size = myArray.GetSize(); Console.WriteLine("Your array's size is:" + size); DisplayArray(myArray); TestAgain(test); } catch { ErrorAsk(test); } }
public static void DisplayArray(ArrayInt a) { string message = ""; int j = 1; Console.WriteLine("Your array has:"); for (int i = 0; i <= a.GetSize(); i++, j++) { if (j % 5 == 0) { j = 0; message += " " + a.GetAt(i).ToString() + System.Environment.NewLine; } else { message += " " + a.GetAt(i).ToString() + " "; } } Console.Write(message + System.Environment.NewLine); }