0% found this document useful (0 votes)
9 views2 pages

My First Programme Calculator

The document describes a C++ program that takes in two numbers and an operator from the user and performs the calculation based on the operator entered. The program uses a switch statement to evaluate the operator and perform the appropriate calculation.

Uploaded by

atharva kulkarni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

My First Programme Calculator

The document describes a C++ program that takes in two numbers and an operator from the user and performs the calculation based on the operator entered. The program uses a switch statement to evaluate the operator and perform the appropriate calculation.

Uploaded by

atharva kulkarni
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

My first Calculator programme

#include <iostream>

using namespace std;

int main()

int n1,n2;

cout<<"Input your two no.";

cin>>n1>>n2;

char op;

cout<<"input your operator"<<endl;

cin>>op;

switch (op)

case '+': cout<<n1+n2<<endl;

break;

case '-': cout<<n1-n2<<endl;

break;

case '*': cout<<n1*n2<<endl;

break;

case '/': cout<<n1/n2<<endl;

break;

default: cout<<"invalid input"<<endl;

break;

}
My first Calculator programme

return 0;

You might also like