{
class Program
{
static void Main(string[] args)
{
string[,] name = new string[,] { {"1504","Marry","Ella","Steve","Bob"},{"1133","Elizabeth","Alex","David","Joe"},{"2624","Jeol","Chris","Craig","Bill"}};
Console.WriteLine("Original name list");
Original(name);
Console.WriteLine("Left pad name list");
Left(name);
Console.WriteLine("Right pad name list");
Right(name);
}
public static void Original(string[,] str)
{
for (int outer = 0; outer <= str.GetUpperBound(0); outer++)
{
for (int inner = 0; inner <= str.GetUpperBound(1); inner++)
{
Console.Write(str[outer, inner]+" ");
}
Console.WriteLine();
}
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}
public static void Left(string[,] str)
{
for (int outer = 0; outer <= str.GetUpperBound(0); outer++)
{
for (int inner = 0; inner <= str.GetUpperBound(1); inner++)
{
Console.Write(str[outer, inner].PadLeft(10) + " ");
}
Console.WriteLine();
}
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}
public static void Right(string[,] str)
{
for (int outer = 0; outer <= str.GetUpperBound(0); outer++)
{
for (int inner = 0; inner <= str.GetUpperBound(1); inner++)
{
Console.Write(str[outer, inner].PadRight(10) + " ");
}
Console.WriteLine();
}
Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}
}
}


No comments:
Post a Comment