Using C++, how to randomly generate either one, two or three digits.
-----------------------updated 2020/3/17-------------------------------
Thanks so much for helping me !! I've seen all the comments.
And what I mean is how to randomly generate an integer.
So when it "cout", the integer should either be 1 digit , 2 digits or 3 digits.
Actually it's part of following question. Please take a look.
Question:
Modify SubtractionQuiz.cpp so that it will become a SimpleMathematicalQuiz.cpp that has the following features:
i) A text menu will be displayed below to ask user to select an option: 1) Addition, 2) Subtraction, 3) Multiplication, 4) Exit.
ii) Then, after the user select option 1, 2 or 3, it will prompt user to input the number of operands (Maximum is 4 and minimum is 2).
iii) Then, the program will generate random numbers for the operands, which should be either one, two or three digits.
iv) It will display the formula and ask user to input the guessing answer.
v) Then, the program will evaluate whether the guessing answer is correct. If correct, state “It is correct.”; otherwise, state “It is wrong.” and give correct answer.
vi) Then, it will go back to i) to show text menu again which prompts user to select an option.
vii) At the end, if user selects option 4, it will show the total number of questions answered; the number of answers correct and wrong respectively and the mark (number of answers correct / total number of questions answered * 100).
Sample output: (Contents in bold type are input values)
1. Addition
2. Subtraction
3. Multiplication
4. Exit
Please select an option: 1
How many operands: 3
34 + 8 + 126
Please input your answer: 180
It is wrong! The answer should be 168
1. Addition
2. Subtraction
3. Multiplication
4. Exit
Please select an option: 3
How many operands: 2
56 * 28
Please input your answer: 1568
It is correct!
1. Addition
2. Subtraction
3. Multiplication
4. Exit
Please select an option: 2
How many operands: 3
86 – 7 - 139
Please input your answer: -50
It is wrong! The answer should be -60
Are you wanting to generate up to 3 different 1 digit numbers, or a 1 digit, 0 to 9, 2 digit, 10 to 99, or 3 digit, 100 to 999, number, maybe by user input?