Hi,
I made one code which sorts numbers from the smallest to the biggest.
Can anyone please write comments in my code what exactly an individual pseudo-code do ?
I'm very confused about that pseudo-codes and don't exactly know what are arrays's functions in that code.
The code is:
int i, j, k;
int[] a = new int[10];
for (i = 0; i < 10; i++)
{
Console.Write("Enter the number:", i);
a[i] = int.Parse(Console.ReadLine());
if (a[i] == 0)
break;
}
for (i = 0; i < 10; i++)
{
for (j = i + 1; j < 10; j++)
{
if (a[i] > a[j])
{
k = a[i];
a[i] = a[j];
a[j] = k;
}
}
}
Console.WriteLine("------------------------------------------------------");
Console.WriteLine("Show sorted numbers from the smallest to the biggest :");
Console.WriteLine("------------------------------------------------------");
for (i = 0; i < 10; i++)
{
Console.WriteLine("{0}. Number = {1}", i, a[i]);
}
Console.ReadLine();
I would be very thankful if someone can help me with that.
danuz