Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

chris200x9

macrumors 6502a
Original poster
Jun 3, 2006
906
0
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' );
}
 

chris200x9

macrumors 6502a
Original poster
Jun 3, 2006
906
0
never mind I know what I did I somehow remembered to but a } to end a do loop but I never started it lol.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.