Hi,
I am new to learning c# and I am currently trying to unpick the errors in a piece of code as practice. I feel clear on what a switch statement is, but I can't see how to correct it to make it work.
I have two questions, the first is can the case value be a situation/scenario, eg. 'when a value is lower than....' or does it have to be an absolute value?
Secondly, does the output of a switch statement have to be a text string or can it be an instruction?
Below is the code I am trying to unravel. Any help, much appreciated.
int
high = -32768;
low = 32767;
number = 0 = count = total = 0;
{
Console.WriteLine("\nEnter a Number for repetitions:");
number = Int32.Parse(Console.ReadLine());
Console.WriteLine("\nNumber must be greater than 1");
}
Console.WriteLine("Enter number {0} : ", count+1);
values = Console.ReadLine();
Switch(values);
total = total + values;
average = total/ number;
Console.WriteLine("\nAverage of {0} numbers is {1}", number, average);
Console.WriteLine("nHighest is {2}. Lowest is {3}", high, low);
Console.ReadLine();