Write a program that asks the user for two integers and a


Write a program that asks the user for two integers and a character, 'A', 'S', or 'M'. Call one of three functions that adds, substracts, or multiplies the user's integers, based on the character input.

This is what I have so far but I cant figure out how to link the character data A, M, or S to the specific funtions.

#include

using namespace std;

void main()
{
int a, b;
char c;
int result=0;

cout << " Please enter first integer: ";
cin>> a;

cout << " Please enter second integer: ";
cin>> b;

cout << "nnn(A) Additionnnn(M) Multiplicationnnn(S) SubstractionnnnPlease enter a character input: ";
cin>> c;
while (c!='A' && c!='a' && c!='M' && c!='m' && c!='S' && c!='s')
{
cout<<"Invalid selection.nnYou must enter a valid selection A, M, or S.nn"<

cout<<"Please enter a character input: ";
cin>>c;
cout<}//end while
if (c == 'A' || c == 'a')
{

}
}
int resultAdd(int num1, int num2)
{
int result;
result = num1 + num2;
cout<<"The sum of two integers is: " <return result;
}

int resultMult(int num1, int num2)
{
int result;
result = num1 * num2;
cout<<"The multiplication of two integers is: " <return result;
}

int resultSub(int num1, int num2)
{
int result;
result = num1 - num2;
cout<<"The difference between two integers is: " <return result;
}

Attachment:- twoIntegers.zip

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a program that asks the user for two integers and a
Reference No:- TGS01247802

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)