hi I just can't see it can someone please tell me what is wrong with this function
Code:
void SubtractionProblems(int& subAtt, int& subCorr)
{
int x, y;
int answer;
char op;
// generate two random numbers
x = rand() % 5 + 5;
y = rand() % 5 + 1;
// display to the user
cout << "What is " << x << " - " << y << "? ";
// get answer
cin >> answer;
if( answer == x - y ) {
cout << "Congratulations! You got it right." << endl;
// increment number of correct
subCorr++;
}
else {
cout << "Sorry, but that answer was incorrect." << endl;
} // end if
cout << "Would you like to do another one (y/n)? ";
cin >> op;
} while( op == 'y' || op == 'Y' );
}