1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
void add_fun(int a,int b);
void sub_fun(int a,int b);
void mult_fun(int a,int b);
void div_fun(int a,int b);
int main()
{
int a,b,c;
cout<<"Enter a Number"<<endl;
cin>>a;
cout<<"One More"<<endl;
cin>>b;
cout<<"1 for addition, 2 for subtraction, 3 for multiplication, 4 for division"<<endl;
cin>>c;
if (c==1)
{
add_fun(a,b);
}
else if (c==2)
{
sub_fun(a,b);
}
else if (c==3)
{
mult_fun(a,b);
}
else
{
div_fun(a,b);
}
return 0;
}
void add_fun(int a,int b)
{
cout<< a+b<<endl;
}
void sub_fun(int a, int b)
{
cout<<a-b<<endl;
}
void mult_fun(int a, int b)
{
cout<<a*b<<endl;
}
void div_fun (int a, int b)
{
cout<<a/b<<endl;
}
|