CALCULATOR CODE
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
char ans='y';
while (ans=='y' || ans== 'Y')
{
float a,b,c,d;
double pi=3.14159265;
cout<<" <<@ Calculator By Hashmat naqvi @>>"<<endl;
cout<<" Press 1 for Addition"<<endl;
cout<<" Press 2 for Subtrection"<<endl;
cout<<" Press 3 for Division"<<endl;
cout<<" Press 4 for Multiplication"<<endl;
cout<<" Press 5 for Square"<<endl;
cout<<" Press 6 for Compairing Numbers"<<endl;
cout<<" Press 7 for Grades Calculator"<<endl;
cout<<" Press 8 for Cube"<<endl;
cout<<" Press 9 For Square Root"<<endl;
cout<<" press 0 For Exit"<<endl;
cout<<" Enter Your Choice : ";
cin>>c;
if (c==1)
{
cout<<" ADDITION:"<<endl;
cout<<" Enter 1st Number:"<<endl;
cin>>a;
cout<<" Enter 2nd Number:"<<endl;
cin>>b;
cout<<" Result Is:"<<a+b<<endl;
}
else if (c==2)
{
cout<<" SUBRRECTION:"<<endl;
cout<<" Enter 1st Number:"<<endl;
cin>>a;
cout<<" Enter 2nd Number:"<<endl;
cin>>b;
cout<<" Result Is:"<<a-b<<endl;
}
else if (c==3)
{
cout<<" DIVISION:"<<endl;
cout<<" Enter 1st Number:"<<endl;
cin>>a;
cout<<" Enter 2nd Number:"<<endl;
cin>>b;
cout<<" Result Is:"<<a/b<<endl;
}
else if (c==4)
{
cout<<" MULTIPLICATION:"<<endl;
cout<<" Enter 1nd Number:"<<endl;
cin>>a;
cout<<" Enter 2nd Number:"<<endl;
cin>>b;
cout<<" Result Is:"<<a*b<<endl;
}
else if (c==5)
{
cout<<" SQUARE:"<<endl;
cout<<" Enter Number:"<<endl;
cin>>a;
cout<<" Result is:"<<a*a<<endl;
}
else if (c==6)
{
cout<<" COMPAIRING NUMBERS"<<endl;
cout<<" Enter 1st Number:"<<endl;
cin>>a;
cout<<" Enter 2nd Number:"<<endl;
cin>>b;
cout<<" Enter 3rd Number:"<<endl;
cin>>d;
if (a>b&&a>d)
{
cout<<" 1st Number Is Greater"<<endl;
}
else if (b>a&&b>d)
{
cout<<" 2nd Number Is Greater"<<endl;
}
else
{
cout<<" 3rd Number Is Greater"<<endl;
}
}
else if (c==7)
{
cout<<" GRADES CALCULATOR"<<endl;
cout<<" Enter your Marks Percentage:"<<endl;
cin>>a;
if (a<60)
{
cout<<" You are Fail : Work Hard & Try Again"<<endl;
}
else if (a<68)
{
cout<<" You get C : Work Hard"<<endl;
}
else if (a<76)
{
cout<<" You Get C+ : Good"<<endl;
}
else if (a<83)
{
cout<<" You Get B : V.Good"<<endl;
}
else if (a<89)
{
cout<<" You Get B+ : Great"<<endl;
}
else if (a<=100)
{
cout<<" You Get A : Excellent"<<endl;
}
else
{
cout<<" INVALID INPUT"<<endl;
}
}
else if (c==8)
{
cout<<" CUBE"<<endl;
cout<<" Enter Number"<<endl;
cin>>a;
cout<<" Result="<<a*a*a<<endl;
}
else if (c==9)
{
cout<<" SQUARE ROOT"<<endl;
cout<<" Enter Number"<<endl;
cin>>a;
cout<<" Result is="<<sqrt (a)<<endl;
}
else if (c==0)
{
cout<<" Bye Bye"<<endl;
}
else
{
cout<<" INVALID INPUT"<<endl;
}
{
cout<<" THANKS FOR USING MY CALCULATOR"<<endl;
cout<<" See You Soon"<<endl;
}
cout<<"Do YOu want to Continue or recalculate Yes(Y),No (N)";
cin>>ans;
}
system ("pause");
return 0;
}