How do you reverse the list in order to display A-Z in reverse from "ZYX....A" I tried to create the ReverseAlpha method but I'm not sure what to do from there.
static void Main(string[] args) {
//variable declarations
const int SIZE = 26;
char[]
alpha = new char[SIZE];
//function calls
FillAlpha(alpha);
Console.WriteLine("Print Original List A-Z:");
PrintAlpha(alpha);
ReverseAlpha(alpha);
Console.WriteLine("\nPrint Reversed List Z-A:");
PrintAlpha(alpha);
Console.Write("\n\nPress any key to continue:");
Console.ReadKey();
}
static void FillAlpha(char[] letters) {
for (int i = 0; i < 26; i++) {
letters[i] = (char)(i + 65);
}
}
static void PrintAlpha(char[] letters) {
foreach(char c in letters)
Console.Write(c + " ");
Console.WriteLine();
}
static void ReverseAlpha(char[] letters) {
char a, b, temp;
temp = a;
a = b;
b = temp:
}
ReverseAlphafunction doesn't do anything. You should try harder.ReverseAlphamethod doesn't even compile. Make sure your code actually compiles first.alpha, which happens to be a char array, but your methods will work on any array so consider leavingAlphaout of the method names, and instead do something likestatic void FillArray(char[] input, int size)