Solution:-
#include<iostream>
#include<conio.h>
using namespace std;
//Prototypre of sum
double add(double,double);
//Prototypre of subtraction
double sub(double,double);
//Prototypre of subtraction
double multi(double,double);
//Prototypre of Division
double divide(double,double);
int main()
{
double sum=0,subtract=0,multy=0,div=0,number1=0,number2=0;
int menu;
cout<<"Please Select any on from below \n";
do
{
cout<<"\n1--Addition \n";
cout<<"2--Subtraction\n";
cout<<"3--Multiplication\n";
cout<<"4--Division\n";
cout<<"0--Close\n";
cin>>menu;
if(menu==0)
{
break;
}
cout<<"Enter the value of number 1 = ";
cin>>number1;
cout<<"Enter the value of number 2 = ";
cin>>number2;
if(menu==1)
{
sum=add(number1,number2);
cout<<"Sum is = "<<sum;
}
else if(menu==2)
{
subtract=sub(number1,number2);
cout<<"Subtraction is = "<<subtract;
}
else if(menu==3)
{
multy=multi(number1,number2);
cout<<"Multiplication is = "<<multy;
}
else if (menu==4)
{
div=divide(number1,number2);
cout<<"Division is = "<<div;
}
}
while(menu!=0);
getch();
}
// define of sum
double add(double no1,double no2)
{
double sum;
sum=no1+no2;
return sum;
}
// define of Subtraction
double sub(double no1,double no2)
{
double sub;
sub=no1-no2;
return sub;
}
// define of multiplication
double multi(double no1,double no2)
{
double multi;
multi=no1*no2;
return multi;
}
// define of Division
double divide(double no1,double no2)
{
double div;
div=no1/no2;
return div;
}
#include<iostream>
#include<conio.h>
using namespace std;
//Prototypre of sum
double add(double,double);
//Prototypre of subtraction
double sub(double,double);
//Prototypre of subtraction
double multi(double,double);
//Prototypre of Division
double divide(double,double);
int main()
{
double sum=0,subtract=0,multy=0,div=0,number1=0,number2=0;
int menu;
cout<<"Please Select any on from below \n";
do
{
cout<<"\n1--Addition \n";
cout<<"2--Subtraction\n";
cout<<"3--Multiplication\n";
cout<<"4--Division\n";
cout<<"0--Close\n";
cin>>menu;
if(menu==0)
{
break;
}
cout<<"Enter the value of number 1 = ";
cin>>number1;
cout<<"Enter the value of number 2 = ";
cin>>number2;
if(menu==1)
{
sum=add(number1,number2);
cout<<"Sum is = "<<sum;
}
else if(menu==2)
{
subtract=sub(number1,number2);
cout<<"Subtraction is = "<<subtract;
}
else if(menu==3)
{
multy=multi(number1,number2);
cout<<"Multiplication is = "<<multy;
}
else if (menu==4)
{
div=divide(number1,number2);
cout<<"Division is = "<<div;
}
}
while(menu!=0);
getch();
}
// define of sum
double add(double no1,double no2)
{
double sum;
sum=no1+no2;
return sum;
}
// define of Subtraction
double sub(double no1,double no2)
{
double sub;
sub=no1-no2;
return sub;
}
// define of multiplication
double multi(double no1,double no2)
{
double multi;
multi=no1*no2;
return multi;
}
// define of Division
double divide(double no1,double no2)
{
double div;
div=no1/no2;
return div;
}
0 Questions:
Post a Comment