Quote Originally Posted by davids2004 View Post
Ok got it all working now
Glad to hear it!

On the subject of formatting though, I suggest you clean up that block of declarations at the top - it took me a few mins just to find the start of the 'do while' loop. The idea with the indentation is to show the hierarchy of the design, so for example, the 'do while' loop should be higher up that hierarchy than all your various "if (choice==...)" conditions.

e.g.
Code:
int main ()
{
	srand((unsigned)time(0));
	int add1, add2, sub1, sub2;
	int multiply1, multiply2, div1, div2;
	int choice, input;

	do
	{
		add1 = (rand()%500)+1;
		add2 = (rand()%500)+1; 
		sub1 = (rand()%500)+1;
		sub2 = (rand()%98)+1;
		multiply1 = (rand()%98)+1;
		multiply2 = (rand()%8)+1;
		div1 = (rand()%500)+1;
		div2 = (rand()%8)+1;
		int addAnswer = add1 + add2;
		subAnswer = sub1- sub2;
		int multiplyAnswer = multiply1 * multiply2;
		divAnswer = div1 / div2;

		//...

		while (choice < 1 || choice > 5)
		{
			cout << "That is not a valid option\n";
			cout <<"Enter your choice (1-5): ";
			cin >> choice;
			cout << "\n";
		}

		if (choice == 1)
		{
			cout << setw (6) << add1 << "\n"; 
			cout << "+ ";
			cout << setw (4) << add2 << "\n";
			cout << "------";
			cout << "\n";
			cin >> input; 
			cout << "\n";

			if (input == addAnswer)
			{
				cout << "Congratulations\n";
			}

			else
			{
				cout << "That is incorrect,\nThe correct answer is: " << addAnswer;
			}

			cout << "\n";
			cout << "\n";
		}

		//...

	} while (choice !=5);
}
On a side note: I gather it's kind of bad practice to format your loops/conditions like this, as it's easy to add a line, and forget that it is no longer included in the loop:
Code:
if (choice==1)
cout << "choice is one.";
cout << "this line is not in the loop...";
You should either do like I did above, and include braces, or put it all on one line:
Code:
if (choice==1) cout << "this is the only statement for this condition";