Hi! I'm new to C++. I have a basic calculator I have to make which requires the user to input to values and choose from the options (A-D and Q *for quit*) what action they want done with those numbers. The program must loop continuously until the user decides to quit.
The issue I'm having is I keep getting the following error for all five options:
error 'A' (or one of the other letters) was not declared in this scope
Please give me advice on how to fix this so that my option choices are declared.
#include <iostream>
usingnamespace std;
int number1, number2, choice, total;
int main()
{
cout << "Please enter two numbers: ";
cout << "Input number 1: ";
cin >> number1;
cout << "Input number 2: ";
cin >> number2;
cout<< "What would you like to do with those numbers? Your options are:\n "
<< "A Addition \n" <<
"B Subtraction \n" <<
"C Multiply \n" <<
"D Divide \n" <<
"Q Quit \n";
cin >> choice;
switch(choice)
{
case A:
total = number1+ number2;
cout << "Your total is " << result << "\n\n";
break;
case B:
total = number1- number2;
cout << "Your total is " << result << "\n\n";
break;
case C:
total = number1* number2;
cout << "Your total is " << result << "\n\n";
break;
case D:
total = number1/ number2;
cout << "Your total is " << result << "\n\n";
break;
}
if(choice == Q) break;
}
return 0;
}