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:
rand() for random number generator. For starters, rand() will always generate the same number on runtime no matter how many times you call it. However, with
srand(), you'll most probably generate a different number.
I have done once a project with
srand() will update should I find that. Then, for the control structure, you may want to consider a switch statement by comparing the ASCII value of the input. (65 = 'A', 66 = 'B' and so on. This is if you are not considering lowercase as input.)
C++ reference :
Since you've stated the control structure you've been exposed is only upto if, then it should suffice should you do like this
if(input == 'A') //do stuff here else if(input == 'B') //do stuff here ...continue the pattern else //should it fail from A to E std::cout << "*";