We like to see errors. Most people on this site won't copy, paste and compile your code.
I did because of the number of issues I saw at first glance.
- When you type something like this:
|
case '+' : cout<< " total is " << num3 = num1 + num2;
|
You should have braces like this:
|
case '+' : cout<< " total is " << (num3 = num1 + num2);
|
So that you compiler knows what to do first, in this case it will assign the sum of num1 & num2 to num3; THEN it knows to output to std::cout.
- This:
1 2 3
|
cout << "Quit? (Y or N) /n";
cin >> quit;
} (while quit != 'Y');
|
Should be:
1 2 3
|
cout << "Quit? (Y or N) /n";
cin >> quit;
} while (quit != 'Y'); /*See here where I moved the brace?*/
|
- Where do you grab "num2" from the user?
- Where do you grab "op" from the user?
- Your Quit option should be inside of the do while loop.
- You only need to declare num3 once. So fix this case:
1 2 3
|
{ case '+' : cout<< " total is " << num3 = num1 + num2;
double num3 = num1;
break; // addition
|
That should be enough for now. Fix those and we'll continue later.