Question

please write it in C++ programming Branching [10pts] Write a program that mimics a calculator. The...

please write it in C++ programming

Branching

[10pts]

Write a program that mimics a calculator. The program should take as input two integers

and the operation to be performed. It should then output the numbers, the operator, and the

result. (For division, if the denominator is zero, output an appropriate message.) Your program

should implement the addition, subtraction, multiplication and division. You are free to implement

other operations, but your program should contain at least the four operations listed above.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>

using namespace std;
void mimics(int a,int b,char c){
   switch(c){
       case '+':cout<<a<<" + "<<b<<" = "<<a+b<<endl;break;
       case '-':cout<<a<<" - "<<b<<" = "<<a-b<<endl;break;
       case '*':cout<<a<<" * "<<b<<" = "<<a*b<<endl;break;
       case '/':
       if(b==0)
           cout<<"Can't divide by 0";
       else
           cout<<a<<" * "<<b<<" = "<<a*b<<endl;break;
      
   }  
  
}
int main()
{
mimics(10,2,'+');
mimics(4,5,'*');
return 0;
}

Note : Please comment below if you have concerns. I am here to help you

If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
please write it in C++ programming Branching [10pts] Write a program that mimics a calculator. The...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT