// Program AddSub reads in a letter (A or S) and two int values.
// If the letter is A, the two values are added.
// If the letter is S, the second is subtracted from the first.
// The answer is printed appropriately labeled.
#include <iostream>
usingnamespace std;
int main ()
{
char operatorCode;
int value1;
int value2;
int answer;
cout << "Input a letter and two integer values." << endl;
cout << "If the letter is an A, the values are added." << endl;
cout << "If the letter is an S,"
<< "the second value is subtracted from the first." << endl;
cout << endl;
cin >> operatorCode;
cin >> value1 >> value2;
cout << endl;
if (operatorCode = 'A')
{
answer = value1 + value2;
cout << value1 << " plus " << value2
<< " is " << answer << endl;
}
else
{
if (operatorCode = 'S')
{
answer = value1 - value2;
cout << value1 << " minus " << value2
<< " is " << answer << endl;
}
}
system("PAUSE");
return 0;
}