#include<iostream> #include<iomanip> #include<cstdlib> using namespace std; int main() { int num1; int num2; char choice; start : cout<<setw(45)<<"Plz Select Options you needed :\n\n"<<endl; cout<<"Press A to find sum of two numbers."<<endl; cout<<"Press S to subtract two numbers."<<endl; cout<<"Press M to multiple two numbers."<<endl; cout<<"Press D to Divide two numbers."<<endl; cout<<"Press F to find factorial of any number."<<endl; cout<<"Press R to restart the program."<<endl; cout<<"Press Y to End the Program"<<endl; cout<<"\nDeveloped by:\n"<<setw(25)<<"zubair saif.."<<endl; system("color 5f"); cin>>choice; system("CLS"); switch(choice) { case 'y' : return 0; case 'a': cout<<"Enter first number:"; cin>>num1; cout<<"Enter second number:"; cin>>num2; cout<<"The Sum is:\n "; cout<<num1+num2; cout<<"\n\nDeveloped by:\n"<<setw(25)<<"zubair saif.."<<endl; cout<<endl; goto start ; case 's': cout<<"Enter first number:"; cin>>num1; cout<<"Enter second number:"; cin>>num2; cout<<"Subtraction is:\n"; cout<<num1-num2; cout<<"\n\nDeveloped by:\n"<<setw(25)<<"zubair saif.."<<endl; cout<<endl; goto start ; break; case 'm': cout<<"Enter first number:"; cin>>num1; cout<<"Enter second number:"; cin>>num2; cout<<"MUltiplication is:\n"; cout<<num1*num2; cout<<"\n\nDeveloped by:\n"<<setw(25)<<"zubair saif.."<<endl; cout<<endl; goto start ; break; case 'd': cout<<"Enter first number:"; cin>>num1; cout<<"Enter second number:"; cin>>num2; cout<<"Divided is:\n"; cout<<num1/num2; cout<<"\n\nDeveloped by:\n"<<setw(25)<<"zubair saif .."<<endl; cout<<endl; goto start ; break; case 'r': goto start ; break; case 'f': int g; cout<< "Enter the value for finding factorial : "; cin>>g; cout<<"\n"; int fact = 1; for(int i=1; i<=g;i++) { fact = fact * i; } cout<<"factorial of given number is "<<fact<<endl; cout<<"\n\nDeveloped by:\n"<<setw(25)<<"zubair saif.."<<endl; goto start ; break; system("CLS"); } }
Subscribe to:
Post Comments (Atom)
Post A Comment:
0 comments: