Hi there!
I am new to C++ and well.. I was experimenting on my own with a calculator program.. Just trying to get my feet wet.. I don't know what is wrong with this program, but I keep getting parse errors before the else keywords.. Here is the code snippet that is giving me trouble:
if (operationChoice > 1)
{
if (operationChoice == 2)
answer = Subtraction(firstNumber, secondNumber);
std::cout << "The answer is: " << answer << " .\n\n";
else
{
if (operationChoice == 3)
answer = Multiplication(firstNumber, secondNumber);
std::cout << "The answer is: " << answer << " .\n\n";
else
answer = Division(firstNumber, secondNumber);
std::cout << "The answer is: " << answer << " .\n\n";
}
}
else
answer = Addition(firstNumber, secondNumber);
std::cout << "The answer is: " << answer << " .\n\n";
I have all the variables declared and the functions prototyped.. Cases all match, no typos or anything.. I will also upload the .cpp file so if this code snippet is not enough.
Any suggestions would be appreciated.
Wanderin Weezard
[email protected]