Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Educational Game: Write a program that helps an elementary school student learn

ID: 3617683 • Letter: E

Question

 Educational Game: Write a program that helps an elementary school student 
learn multiplication. Use rand to produce two positive one-digit integers. It
should then type a question such as

How much is 6 times 7?

The student types the answer. Your program checks the answer. If it is correct,
print 'Very Good', then ask another multiplication question. If wrong, print
'No, please try again'.
Let the student repeatedly try until the right answer.

The various comments for correct and incorrect answers are printed as follows:

Correct answer responses:
- Very good!
- Excellent!
- Nice work!
- Keep up the good work!

Incorrect answer responses:
- No. Please try again.
- Wrong. Try once more.
- Don't give up.
- Not really, keep trying.

Use random number generator to choose a number from 1 to 4 to select an
appropriate response to each answer. Use switch statement to issue the
responses.

Output:

Enter -1 to End.
How much is 0 times 7 (-1 to End)? 0
Nice work!

How much is 7 times 5 (-1 to End)? 35
Keep up the good work!

How much is 7 times 5 (-1 to End)? 35
Very good!

How much is 6 times 9 (-1 to End)? 54
Excellent!

How much is 8 times 8 (-1 to End)? 4
No. Keep trying.
? 5
No. Keep trying.
? 6
Don't give up!
? 7
No. Please try again.
? 3
No. Keep trying.
? 5
Wrong. Try once more.
? 6
No. Please try again.
? 7
No. Please try again.
? 8
Don't give up!
? 6
Wrong. Try once more.
? 64
Nice work!

How much is 7 times 0 (-1 to End)? -1
That's all for now. Bye.

Explanation / Answer


#include<iostream> #include<stdlib> using namespace std; int main() { int a,b,result,num; int r; while(1) { a=rand()%10+1; b=rand()%10+1; cout<<" How Much is "<<a<<" times"<<b<<" (-1 to exit) ? "; cin>>num; result=a*b; if(num==-1) break; else if(num==result) { r=rand()%4+1; switch(r) { case 1: cout<<" Nice Work"; break; case 2: cout<<" Excellent"; break; case 3: cout<<" Very Good"; break; case 4: cout<<" Keep Up the Good Work!"; break; } } //end elseif else { r=rand()%4+1; switch(r) { case 1: cout<<" No. Please try again"; break; case 2: cout<<" wrong. Try once more."; break; case 3: cout<<" Dont give up"; break; case 4: cout<<" Not really, keep trying."; break; } } //end elseif
} //end loop system("pause"); return 0; }
#include<iostream> #include<stdlib> using namespace std; int main() { int a,b,result,num; int r; while(1) { a=rand()%10+1; b=rand()%10+1; cout<<" How Much is "<<a<<" times"<<b<<" (-1 to exit) ? "; cin>>num; result=a*b; if(num==-1) break; else if(num==result) { r=rand()%4+1; switch(r) { case 1: cout<<" Nice Work"; break; case 2: cout<<" Excellent"; break; case 3: cout<<" Very Good"; break; case 4: cout<<" Keep Up the Good Work!"; break; } } //end elseif else { r=rand()%4+1; switch(r) { case 1: cout<<" No. Please try again"; break; case 2: cout<<" wrong. Try once more."; break; case 3: cout<<" Dont give up"; break; case 4: cout<<" Not really, keep trying."; break; } } //end elseif
} //end loop system("pause"); return 0; }
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote