#include<iostream>
using namespace std;
void sum()
{
int n1,n2;
cout<<"enter first number:";
cin>>n1;
cout<<"enter second number:";
cin>>n2;
cout<<"the sum is:"<<n1+n2<<endl;
}
void sub()
{
int n1,n2;
cout<<"enter first number:";
cin>>n1;
cout<<"enter second number:";
cin>>n2;
cout<<"the sub is:"<<n1-n2<<endl;
}
void product()
{
int n1,n2;
cout<<"enter first number:";
cin>>n1;
cout<<"enter second number:";
cin>>n2;
cout<<"the product is:"<<n1*n2<<endl;
}
void div()
{
int n1,n2;
cout<<"enter first number:";
cin>>n1;
cout<<"enter second number:";
cin>>n2;
cout<<"the division is:"<<n1/n2<<endl;
}
void menu()
{
cout<<"press 1 for addition:"<<endl;
cout<<"press 2 for subraction:"<<endl;
cout<<"press 3 for multiply:"<<endl;
cout<<"press 4 for division:"<<endl;
}
int main()
{
int n;
menu();
cin>>n;
if(n==1)
sum();
else if(n==2)
sub();
else if(n==3)
product();
else if(n==4)
div();
else
cout<<"you entered wrong input";
}
No comments:
Post a Comment