Loop Breaking

Cant figure out why the loop keeps getting broken when I enter y at the end and doesnt loop!

#include <iostream>
#include <ctime>
using namespace std;


int main()
{char goagain;

do {

int guess;
int answer;
int numofprobs = 00;
double mprob;
srand(0);
cout << "How many multiplication Problems: " << endl;
cin >> mprob;
double numguess = 00;
for (int numofprobs = 0; numofprobs < mprob; numofprobs++)
{
int multi1 = rand() % 10 + 1;
int multi2 = rand() % 10 + 1;

do {
cout << multi1 << " x " << multi2 << " = " << endl;
answer = multi1 * multi2;
cin >> guess;
numguess++;
} while (guess != answer);
cout << "Correct!" << endl;
}


double accuracy = ((double)mprob * 100) / (double)numguess;
cout << "Congratulations on Completing your Mission!" << endl;
cout << "Problems: " << " " << mprob << " " << " Guesses: " << " " << numguess;
cout << " Accuracy: " << accuracy << "%" << endl;
cout << " Go Again? " << endl;
cin >> goagain;


} while (toupper(goagain)=='y');


cout << " Thanks for using Fun with Multiplication! " << endl;

return 0;
}
toupper() makes a lower case letter upper case. But you are comparing against y which is lower case!
Topic archived. No new replies allowed.