VitzzViperzz
Well-known member
Hello,
Just though I make an array and then put the output to the console which went well...
Then I tried to reverse this output so that it prints the Array outcomes: A1, A2, A3...... in a reversed format with this code:
But the problem is that it literally reverses the actual char cArray, which is kind of pointless because the whole point my exercise was to reverse the actual array output.
What I can see that 'j' which is used as a local variable is the main piece that holds all of the information. I tried making that public and it hated it.
Is there a way to make the j public and then use it to reverse the array outcome? Maybe re-write parts of the main code?
Thanks
Just though I make an array and then put the output to the console which went well...
C#:
char[] cArray = { 'A', 'B', 'C', 'D', 'E' };
for (int i = 0; i < cArray.Length; i++)
{
for (int j = 1; j <= 10; j++)
{
string sf01 = string.Format($"{cArray[i]}{j}");
if (sf01.Equals("C5") == true) break;
Console.Write(sf01); Console.Write(" ");
}
Console.WriteLine();
}
Then I tried to reverse this output so that it prints the Array outcomes: A1, A2, A3...... in a reversed format with this code:
C#:
string reversedString = " ";
for (int index = cArray.Length - 1; index >= 0; index--)
{
reversedString += cArray[index];
}
Console.WriteLine($"Reversed Array: {reversedString}");
Console.ReadKey();
But the problem is that it literally reverses the actual char cArray, which is kind of pointless because the whole point my exercise was to reverse the actual array output.
What I can see that 'j' which is used as a local variable is the main piece that holds all of the information. I tried making that public and it hated it.
Is there a way to make the j public and then use it to reverse the array outcome? Maybe re-write parts of the main code?
Thanks