Oct 23, 2014

Write a program to create calculator operands as input

#include<iostream>
using namespace std;
main()
{
int a,b,c=0;
char ch;
cout<<"Enter a & B and use one of arithmetic operator between a & b, like, 6+5 "<<endl;
cin>>a>>ch>>b;
switch(ch)
{
case '+':
c=a+b;
break;
case '-':
c=a-b;
break;
case '*':
c=a*b;
break;
case '/':
c=a/b;
break;
default:
break;
}
cout<<c;
}

No comments:

Create a Diamond in C++

 #include<iostream> using namespace std; int main() { int i, j, k,r; cout<<"Enter the row of diamond   "; cin>>r...