/* prepared by : HILAL AHMAD HUSSAIN (STUDENT: SOFTWERE ENGINEERING)
*/
#include<iostream>
#include<conio.h>
int add(int a,int b);
int sub(int a,int b);
int mul(int a,int b);
int div(int a,int b);
using namespace std;
int main()
{
int m,n;
xy:
cout<<endl;
cout<<"___________________________________________ __________________________"<<endl;
cout<<"please enter your first number=";
cin>>m;
cout<<endl;
cout<<"please enter your 2nd number=";
cin>>n;
cout<<endl;
cout<<"1: for addition"<<endl;
cout<<"2: for substriction"<<endl;
cout<<"3: for multifaction "<<endl;
cout<<"4: for division"<<endl;
cout<<"please enter your option do you want to operation----";
char op;
cin>>op;
switch(op)
{
if(op=='1')
{
case '1':
add( m, n);
break;
}
else{
cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
}
if(op=='2')
{
case '2':
sub( m, n);
break;
}
else{
cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
}
if(op=='3')
{
case '3':
mul(m, n);
break;
}
else{
cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
}
if(op=='4')
{
case'4':
div( m, n);
}else{
cout<<"dear your enter invilid option please corrent option enter try again"<<endl;
}
default:
cout<<"invilid option----";
}
goto xy;
}
int add(int a,int b)
{
cout<<"--------------------------------"<<endl;
cout<<"the addition of a and b ="<<a+b<<endl;
cout<<"--------------------------------"<<endl;
cout<<endl;
}
int mul(int a, int b)
{
cout<<"--------------------------------"<<endl;
cout<<"the multifaction of a and b="<<a*b<<endl;
cout<<"--------------------------------"<<endl;
cout<<endl;
}
int sub(int a,int b)
{
cout<<"--------------------------------"<<endl;
cout<<"the substraction of a and b="<<a-b<<endl;
cout<<"--------------------------------"<<endl;
cout<<endl;
}
int div(int a,int b)
{
if(b==0)
{
cout<<"--------------------------------"<<endl;
cout<<"a is not divide by zero"<<endl;
cout<<"--------------------------------"<<endl;
}
else
{
cout<<"--------------------------------"<<endl;
cout<<"the division of a and b="<<a/b<<endl;
}
cout<<endl;
}
dear no error see result again
Bookmarks