VitzzViperzz
Well-known member
Hello,
So I tried making an application that would ask a student about the score on their test and then translate that to an alphabetical score. I tried doing this with a switch statement, but it seems to hate using numerical values, or it could just be my coding.
So I initialised the grade variables:
Initially, I did declare them as an int and then specified their grade boundary like this:
But I saw no use for it, so I just stuck to the string type.
I then gathered the user's input and saved it:
Made a variable to store the output of the switch case:
And then I tried setting the switch case which was the downfall of my program:
But as you can see, the switch case is very weird. No one on the internet seems to have faced this problem, so there was really no placed I could've used.
Any help welcome, thanks
So I tried making an application that would ask a student about the score on their test and then translate that to an alphabetical score. I tried doing this with a switch statement, but it seems to hate using numerical values, or it could just be my coding.
So I initialised the grade variables:
C#:
string A;
string B;
string C;
string D;
string E;
string U;
Initially, I did declare them as an int and then specified their grade boundary like this:
C#:
int A = 95;
But I saw no use for it, so I just stuck to the string type.
I then gathered the user's input and saved it:
C#:
Console.WriteLine("Please enter your first score from 0 to 100: ");
int userGrade1 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter your second score from 0 to 100: ");
int userGrade2 = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter your third score from 0 to 100: ");
int userGrade3 = Convert.ToInt32(Console.ReadLine());
Made a variable to store the output of the switch case:
C#:
string endResult1;
And then I tried setting the switch case which was the downfall of my program:
C#:
switch (userGrade1)
{
case => 95:
endResult = A;
break;
}
But as you can see, the switch case is very weird. No one on the internet seems to have faced this problem, so there was really no placed I could've used.
Any help welcome, thanks