Computer Science, asked by alikunjusalam, 17 days ago

write an algorithm to create a calculator two input operand and an operator​ in C++​. step by step​

Answers

Answered by samarthkrv
0

Answer:

#include <iostream>

using namespace std;

int main()

{

   char op;

   int a , b;

   cout<<"Enter an operator:";

   cin>>op;

   cout<<"Enter the 2 numbers: \n";

   cin>>a;

   cin>>b;

   if(op == '+'){

       cout<<(a+b);

   }

   if(op == '-'){

       cout<<(a-b);

   }

   if(op == '*'){

       cout<<(a*b);

   }

   cout<<(a/b);

   return 0;

}

Explanation:

Similar questions