//Steven Velazquez,Michael Reisenweber, Andrei Kuzmiankov
#include <iostream>
#include <cmath>
#include <iomanip>
usingnamespace std;
int
additionQuestions(int max,int questions, int randomseed)
{
int random1,answer=1,count=1,count2=1;
srand(randomseed);
while (answer!=-1&&(count2-1)<=questions)
{
count2++;
random=rand()%max;
random1=rand()%max;
cout<<"How much is "<<random<<" plus "<<random1<<"?";
cin>>answer;
if(answer==-1)
cout<<"You entered -1. exiting...";
else{
if(answer==random+random1)
{
cout<<"\nYou said "<<random<<" + "<<random1<<" = "<<answer<<" ";
cout<<"Very good!\n";
count++;
}
else
{
cout<<"\nYou said "<<random<<" + "<<random1<<" = "<<answer<<" ";
cout<<"No. Sorry, the correct answer is "<<random+random1<<endl;
}
}
}
return (count-1);
}
We have to link it to his program, which decides how many questions there will be(questions), max random(max), and the seed for srand(randomseed).
The problem is that his program returns 700 correct answers and mine only returns like 10-20, and i have no idea how to make it return more.
I can also upload the link file if something.