1.I'm trying to calculate the number of correct/incorrect responses after x number of questions, a running total. i.e. 2 correct 1 incorrect.
2. How to exit the loop before the x number of tries are cycled through.
I'm relatively new to programming and like to work through as much as I can from research etc. Can someone give me a hint on how to do these? Thanks
//random multiplication practice 0-10. Want to keep track of correct/incorrect responses.
#include <iostream>
#include <math.h>
#include <time.h>
#include <cstdlib>
using namespace std;
const int LOW =1;
const int HIGH=10;
int main()
{
int num1;
int num2;
int ans;
int count=0;
int correct;
int incorrect;
cout<< "Your first two numbers to multiply are"" "<<num1<<" ""times"" "<<num2<<endl;
cout<<""<<endl;
cout<<"Please enter your answer"<<endl;
cout<<""<<endl; // that line isnt needed
cin>>ans;
1 2 3 4 5 6 7 8 9 10
do{
if (ans==num1*num2)
{
cout<< "That is correct, good job, Try again!"<<endl;//want to start running total of correct/incorrect for user to see.
num1 =rand() % (HIGH -LOW + 1) ;
num2 =rand() % (HIGH - LOW + 1) ;
cout<< num1<<" ""times"" "<< num2 <<endl;
cin>>ans;
//you need a while statement her i think because you have a do statement above
}
have to go right now so cant look at it anymore sorry