View Single Post
Old May 25th, 2005, 3:56 PM   #4
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 641
Rep Power: 4 Jessehk is on a distinguished road
Quote:
Originally Posted by Ooble
I would change the main section to this:
		bool valid = true;
		switch (oper)
		{
			case '+':
				total = num1 + num2;
				break;
			case '-':
				total = num1 - num2;
				break;
			case '*':
				total = num1 * num2;
				break;
			case '/':
				total = num1 / num2;
				break;
			default:
				printf("Follow the directions next time!\n");
				valid = false;
				break;
		}
		
		if (valid)
		{
			printf("\n\n%.2f %c %.2f = %.2f\n", num1, oper, num2, total);
		}

The general code, however, is pretty damn good.
thanks to both of you!

I'l think about those suggestions Ooble ( although I didn't know there was a case placeholder )
Jessehk is offline   Reply With Quote