Alright, so I was given an assignment in a programming class and I'm a bit confused as to what is being asked of me.
The instructions are as follows:
Assignment
"Loops – Write a for, a while, and a do-while loop. For each loop, ask the user for the number and then loop that many times.
Add a function to your program called GetIfElseGrade. This function will have passed in variable of type int and return of char. The function must use an if-else statement to determine a letter grade A(90 and above), B(80-89), C(70-79), D(below 70).
Add a function to your program called GetRangeCase. This function will pass in the char from above (‘A’, ‘B’, ‘C’, or ‘D’) and will print to the screen “90 and Above”, “80 – 89”, “70 – 79”, “60 – 69”, or “Incorrect Value”). Use a switch Case statement in this function."
Ive completed the loop section with out any problems at all as it was quite easy, however the next section has me somewhat confused. I have the if else statements all lined up and working perfectly, but the instructions that have me make a new function to get the range is where im stumped! He asks to use a switch case statement which makes no sense to me because I thought the user had to enter a number for a switch case statement to execute..
Here is a sample output of how he wants it to look
Enter the number for the 'for' loop 4
'for' loop : 1
'for' loop : 2
'for' loop : 3
'for' loop : 4
Enter the number for the 'while' loop 4
'while' loop : 1
'while' loop : 2
'while' loop : 3
'while' loop : 4
Enter the number for the 'do while' loop 4
'do while' loop : 1
'do while' loop : 2
'do while' loop : 3
'do while' loop : 4
Enter a Grade Value (like 75) 75
Your grade for 75 is C
The Range for your grade is 70 - 79
Press Enter to Continue.
and here is my code I have thus far. Im not sure if I even need to use a character array or not.. Any help is appreciated, I understand that you shouldnt just do it for me because I would like to learn, but I need a push in the right direction!
// RevThis.cpp : Defines the entry point for the console application.
//
He asks to use a switch case statement which makes no sense to me because I thought the user had to enter a number for a switch case statement to execute..
Ah, with a few tests I see now. I was always taught to set selection=0 then the user would have to actually type 1,2 or 3 for the selection they wanted. I see now that it can run automatically. Thank you very much! And thank you for being informative without doing it for me as well!