how to make calculaor in c++
# include
using namespace std;
int main() {
char op;
float num1, num2;
cout << "Enter operator: +, -, *, /: ";
cin >> op;
cout << "Enter two operands: ";
cin >> num1 >> num2;
switch(op) {
case '+':
cout << num1 << " + " << num2 << " = " << num1 + num2;
break;
case '-':
cout << num1 << " - " << num2 << " = " << num1 - num2;
break;
case '*':
cout << num1 << " * " << num2 << " = " << num1 * num2;
break;
case '/':
cout << num1 << " / " << num2 << " = " << num1 / num2;
break;
default:
// If the operator is other than +, -, * or /, error message is shown
cout << "Error! operator is not correct";
break;
}
return 0;
}
calculator in cpp
#include
using namespace std;
// Hi I'm Jillani Soft Tech. I'm a Developer.
main()
{
while(true)
{
int sum,mul,sub,div; // variable decalration
int num1,num2;
int choice;
cout<<"\n\n\t\t\t----------Main Menu-----------"<>choice;
cout<<"Enter frist number : "<>num1;
cout<<"Enter Second number : "<>num2;
if(choice==1)
{
sum=num1+num2;
cout<<"There sum is this : "<
|