View Single Post
Old May 25th, 2005, 8:56 AM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote