Online Visitor Counter

  • RSS
  • Delicious
  • Digg
  • Facebook
  • Twitter
  • Linkedin
  • Youtube

Friday, April 18, 2014

Simple Maths Program

آج جو پروگرام میں پوسٹ کر رہا ہوں اس سے آپ پلس ، مینس وغیرہ کر سکتے ہیں.
اس پروگرام کو رن کریں اور بتایں کے کیسا لگا



#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");
}

ag koe masala ho to yeah ponch saktain hain

No comments:

Post a Comment

 
  • Blogroll

  • Consectetuer

  • Popular

  • Comments