آج جو پروگرام میں پوسٹ کر رہا ہوں اس سے آپ پلس ، مینس وغیرہ کر سکتے ہیں.
اس پروگرام کو رن کریں اور بتایں کے کیسا لگا
#include<iostream>
using namespace std;
void main();
void mainmenu()
{
cout<<" 1.addition"<<endl;
cout<<" 2.subtraction"<<endl;
cout<<" 3.multiplication"<<endl;
cout<<" 4.division"<<endl;
cout<<" 5.remainder"<<endl;
cout<<" 6.factorial"<<endl;
cout<<" 7.even or odd"<<endl;
cout<<" 8.exit"<<endl<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~"<<endl;
}
void add()
{
system("color 4a");
cout<<"~~~~~~~~~~~~~~~you choose addition~~~~~~~~~~~~~~"<<endl<<endl;
double a,b;
cout<<"enter the value of a = ";
cin>>a;
cout<<"enter the value of b = ";
cin>>b;
cout<<endl;
cout<<a<<" + "<<b<<" = "<<a+b<<endl<<endl;
cout<<"1.for again addtion"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Add();
break;
case 2:
Main();
break;
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void sub()
{
system("color 1d");
cout<<"~~~~~~~~~~~~~~~you choose subtraction~~~~~~~~~~~~~~"<<endl<<endl;
double a,b;
cout<<"enter the value of a = ";
cin>>a;
cout<<"enter the value of b = ";
cin>>b;
cout<<endl;
cout<<a<<" - "<<b<<" = "<<a-b<<endl<<endl;
cout<<"1.for again subtraction"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Sub();
break;
case 2:
Main();
break;
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void mul()
{
system("color 5e");
cout<<"~~~~~~~~~~~~~~~you choose multiplication~~~~~~~~~~~~~~"<<endl<<endl;
double a,b;
cout<<"enter the value of a = ";
cin>>a;
cout<<"enter the value of b = ";
cin>>b;
cout<<endl;
cout<<a<<" * "<<b<<" = "<<a*b<<endl<<endl;
cout<<"1.for again multiplication"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Mul();
break;
case 2:
Main();
break;
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void div()
{
system("color 2f");
cout<<"~~~~~~~~~~~~~~~you choose division~~~~~~~~~~~~~~"<<endl<<endl;
double a,b;
cout<<"enter the value of a = ";
cin>>a;
cout<<"enter the value of b = ";
cin>>b;
cout<<endl;
cout<<a<<" / "<<b<<" = "<<a/b<<endl<<endl;
cout<<"1.for again division"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Div();
break;
case 2:
Main();
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void rem()
{
system("color 2b");
cout<<"~~~~~~~~~~~~~~~you choose remainder~~~~~~~~~~~~~~"<<endl<<endl;
int a,b;
cout<<"enter the value of a = ";
cin>>a;
cout<<"enter the value of b = ";
cin>>b;
cout<<endl;
cout<<a<<" % "<<b<<" = "<<a%b<<endl<<endl;
cout<<"1.for again remainder"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Rem();
break;
case 2:
Main();
break;
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void fac()
{
system("color 5b");
cout<<"~~~~~~~~~~~~~~~you choose factorial~~~~~~~~~~~~~~"<<endl<<endl;
int a,b,c;
cout<<"enter the number = ";
cin>>a;
c=a;
for(b=a-1;b>0;b--)
a=b*a;
cout<<endl;
cout<<"factorial of "<<c<<" = "<<a<<endl<<endl;
cout<<"1.for again factorial"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Fac();
break;
case 2:
Main();
break;
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void evod()
{
system("color 6a");
cout<<"~~~~~~~~~~~~~~~you choose even or odd~~~~~~~~~~~~~~"<<endl<<endl;
int a;
cout<<"enter a number = ";
cin>>a;
cout<<endl;
if(a%2==0)
cout<<a<<" is even "<<endl<<endl;
else
cout<<a<<" is odd "<<endl<<endl;
cout<<"1.for again even or odd"<<endl;
cout<<"2.back to main menu"<<endl;
cout<<"3.exit"<<endl;
int o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"enter option = ";
cin>>o;
cout<<endl;
cout<<"~~~~~~~~~~~~~~~~~~"<<endl;
cout<<endl<<endl;
switch(o)
{
case 1:
Evod();
break;
case 2:
Main();
break;
case 3:
Exit(0);
break;
default:
Cout<<"wrong entry"<<endl;
}
}
void main()
{
system("color 2f");
mainmenu();
int o;
cout<<"enter the choice = ";
cin>>o;
cout<<endl;
switch(o)
{
case 1:
Add();
break;
case 2:
Sub();
break;
case 3:
Mul();
break;
case 4:
Div();
break;
case 5:
Rem();
break;
case 6:
Fac();
break;
case 7:
Evod();
break;
case 8:
Exit(0);
break;
default :
Cout<<"wrong entry plese enter again"<<endl<<endl;
main();
}
system("pause");
}
Bookmarks