The use of computers in education is referred to as computer-assisted instructio
ID: 643342 • Letter: T
Question
The use of computers in education is referred to as computer-assisted instruction (CAI). In this exercise, you will write a program that will help an elementary school student learn addition, subtraction, multiplication and division. Allow the user to pick a type of arithmetic problem to study: 1 addition problems only 2 subtraction problems only 3 multiplication problems only 4 division problems only 5 random mixture of all types The program should then prompt the user with a question, such as: How much is 6 times 7? The student inputs the answer. The program checks the student
Explanation / Answer
//C ++ program for kids maths learning
#include <iostream>
#include <ctime>
#include <math.h>
#include <string>
using namespace std;
//function prototypes
bool addtionProblem(int ,int);
bool subtractionProblem(int ,int );
bool divisionProblem(int ,int);
bool multiplicationProblem(int ,int);
bool randomMixture(int ,int);
void generateProblem(int);
int menu();
int main()
{
char ch;
do
{
//calling menu that returns the user choice of selection
int choice=menu();
//generate two random numbers
generateProblem(choice);
//Ask user to continue the game
cout<<"Do you want to contunue[y/n] : ";
cin>>ch;
}while(ch=='y' ||ch=='Y');
//pause the console out put until user enters
//a key to close the program
system("pause");
return 0;
}
//Menu that prompts user to enter choice and
//returns the user choice .Prompt until user
//enter a valid choice.
int menu()
{
int userChoice;
cout<<" --Kids Maths Learning---"<<endl;
cout<<" 1 addition problems only "<<endl;
cout<<" 2 subtraction problems only "<<endl;
cout<<" 3 multiplication problems only"<<endl;
cout<<" 4 division problems only "<<endl;
cout<<" 5 random mixture of all types"<<endl;
//prompt for user until valid choice
do
{
cout<<" Enter your choice: ";
cin>>userChoice;
if(userChoice< 0 || userChoice>5)
cout<<"Invalid Choice ."<<endl;
}while(userChoice<0 || userChoice>5);
return userChoice;
}
//Generate two random numbers and based on user choice
//and called appropriate method using switch case
//and print appropriate message for user answer.
void generateProblem(int choice)
{
string correctMessages[4]=
{"Very Good!", "Excellent!",
" Nice Work!","Keep up the good work!" };
string incorrectMessages[4]=
{"Try again.", "Keep trying."," Try once more."," Don
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.