This is for my intro C++ homework and I'm not sure if I should be asking for homework help on here but I'm going crazy trying to figure this out because everywhere I've looked seems to have a different answer for how to do random numbers with in a given range.
The program will ask the user to enter five single characters separated by spaces, and depending on the characters, it will generate a random number.
Here are the rules: - If input character is 'A', program will generate a random number from 1 to 20.
-
If input character is 'B', program will generate a random number from 21 to 40.
-
If input character is 'C', program will generate a random number from 41 to 60.
-
If input character is 'D', program will generate a random number from 61 to 80.
-
If input character is 'E', program will generate a random number from 81 to 100.
-
If input character is not one of the above characters, display a "*" in the output.
I'm not really sure how to best construct this to output the numbers in the given ranges. Keep in mind this is an intro class so we've only gotten as far as "if" statements and using rand() and srand().
I'm not asking for my homework to be done for me lol. I'm just trying to get an idea of what to do since I can find 2 slides from the powerpoints my professor has given us pertaining to this assignment and I have no clue what to do.
Aucun commentaire:
Enregistrer un commentaire