Calculator in c++
#include<iostream>
#include<conio.h>
#include<math.h>
#include<cmath>
using namespace std;
void function()
{
int p;
float result,digit;
cout<<"1.COS AND COS INVERSE\n";
cout<<"2.SINE AND SINE INVERSE\n";
cout<<"3.TANGENT AND TANGENT INVERSE\n";
cout<<"\nEnter Your Choice:";
cin>>p;
if(p == 1)
{
cout<<"Enter The Digit For Cos And Cos Inverse:";
cin>>digit;
cout<<"The Degree Of Cos is " << cos(digit) <<endl;
cout<<"The Degree Of Cos Inverse is "<<acos(digit)<<endl;
}
else if(p == 2)
{
cout<<"Enter The Digit For Sine And Sine Inverse:";
cin>>digit;
cout<<"The Degree Of Sine is " << sin(digit) <<endl;
cout<<"The Degree Of Sine Inverse is " << asin(digit) <<endl;
}
else if(p==3)
{
cout<<"Enter The Digit For Tangent And Tangent Inverse:";
cin>>digit;
cout<<"The Degree Of Tangent is " << tan(digit) <<endl;
cout<<"The Degree Of Tangent Inverse is " << atan(digit) <<endl;
}
}
void main()
{
int a,b;
int choice;
cout<<"\t\t\t***SCIENTIFIC CALCULATOR***\n\n";
start:
cout<<"\n1.ADDITION 2.SUBTRACTION 3.MULTIPLICATION 4.DIVISION 5.FACTORIAL\n\n";
cout<<"6.MOD 7.SQUARE 8.PERMUTATION 9.TIGNOMETRIC FUNCTION 10.POWER \n\n";
cout<<"11.CEIL 12.ABS 13.FLOOR 14.EXIT\n";
cout<<"\nEnter Your choice:";
cin>>choice;
if(choice==1)
{
cout<<"ADDITION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Sum Is:"<<a+b<<endl;
}
if(choice==2)
{
cout<<"SUBTRACTION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Subtraction Is:"<<a-b<<endl;
}
if(choice==3)
{
cout<<"MULTIPLICATION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Multiplication Is:"<<a*b<<endl;
}
if(choice==4)
{
cout<<"DIVISION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Division Is:"<<a/b<<endl;
}
if(choice==5)
{
cout<<"FACTORIAL\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"The FACTORIAL "<<a<<" Is:"<<a*(a-1)*(a-2)*(a-3)*(a-4)<<endl;
}
if(choice==6)
{
cout<<"MOD\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The MOD Is:"<<(a%b)<<endl;
}
if(choice==7)
{
cout<<"SQUARE\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The SQUARE Of First Digit Is:"<<a*a<<endl;
cout<<"The SQUARE Of Second Digit Is:"<<b*b<<endl;
}
if(choice==8)
{
int a,i,c=1;
cout<<"PERMUTATION\n";
cout<<"\nEnter First Digit:";
cin>>a;
for(i=1;i<=a;i++)
{
c=c*i;
}
cout<<"The PERMUTATION Is:"<<c<<endl;
}
if(choice==9)
{
cout<<"\nTIGNOMETRIC FUNCTION\n\n";
function();
}
if(choice==10)
{
int c=1,a,b;
cout<<"POWER\n";
cout<<"\nEnter Base Digit:";
cin>>a;
cout<<"\nEnter Power Digit:";
cin>>b;
for(int i=1;i<=b;i++)
{
c=a*c;
}
cout<<"The POWER Is:"<<c<<endl;
}
if(choice==11)
{
float c;
cout<<"CEIL\n";
cout<<"\nEnter The Digit:";
cin>>c;
cout<<"The CEIL Is"<<ceil(c)<<endl;
}
if(choice==12)
{
float c;
cout<<"ABS\n";
cout<<"\nEnter First Digit:";
cin>>c;
cout<<"The ABS Is:"<<abs(c)<<endl;
}
if(choice==13)
{
float c;
cout<<"FLOOR\n";
cout<<"\nEnter The Digit:";
cin>>c;
cout<<"The FLOOR Is:"<<floor(c)<<endl;
}
if(choice==14)
{
exit (0);
}
goto start;
getch();
}
#include<conio.h>
#include<math.h>
#include<cmath>
using namespace std;
void function()
{
int p;
float result,digit;
cout<<"1.COS AND COS INVERSE\n";
cout<<"2.SINE AND SINE INVERSE\n";
cout<<"3.TANGENT AND TANGENT INVERSE\n";
cout<<"\nEnter Your Choice:";
cin>>p;
if(p == 1)
{
cout<<"Enter The Digit For Cos And Cos Inverse:";
cin>>digit;
cout<<"The Degree Of Cos is " << cos(digit) <<endl;
cout<<"The Degree Of Cos Inverse is "<<acos(digit)<<endl;
}
else if(p == 2)
{
cout<<"Enter The Digit For Sine And Sine Inverse:";
cin>>digit;
cout<<"The Degree Of Sine is " << sin(digit) <<endl;
cout<<"The Degree Of Sine Inverse is " << asin(digit) <<endl;
}
else if(p==3)
{
cout<<"Enter The Digit For Tangent And Tangent Inverse:";
cin>>digit;
cout<<"The Degree Of Tangent is " << tan(digit) <<endl;
cout<<"The Degree Of Tangent Inverse is " << atan(digit) <<endl;
}
}
void main()
{
int a,b;
int choice;
cout<<"\t\t\t***SCIENTIFIC CALCULATOR***\n\n";
start:
cout<<"\n1.ADDITION 2.SUBTRACTION 3.MULTIPLICATION 4.DIVISION 5.FACTORIAL\n\n";
cout<<"6.MOD 7.SQUARE 8.PERMUTATION 9.TIGNOMETRIC FUNCTION 10.POWER \n\n";
cout<<"11.CEIL 12.ABS 13.FLOOR 14.EXIT\n";
cout<<"\nEnter Your choice:";
cin>>choice;
if(choice==1)
{
cout<<"ADDITION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Sum Is:"<<a+b<<endl;
}
if(choice==2)
{
cout<<"SUBTRACTION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Subtraction Is:"<<a-b<<endl;
}
if(choice==3)
{
cout<<"MULTIPLICATION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Multiplication Is:"<<a*b<<endl;
}
if(choice==4)
{
cout<<"DIVISION\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The Division Is:"<<a/b<<endl;
}
if(choice==5)
{
cout<<"FACTORIAL\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"The FACTORIAL "<<a<<" Is:"<<a*(a-1)*(a-2)*(a-3)*(a-4)<<endl;
}
if(choice==6)
{
cout<<"MOD\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The MOD Is:"<<(a%b)<<endl;
}
if(choice==7)
{
cout<<"SQUARE\n";
cout<<"\nEnter First Digit:";
cin>>a;
cout<<"\nEnter Second Digit:";
cin>>b;
cout<<"The SQUARE Of First Digit Is:"<<a*a<<endl;
cout<<"The SQUARE Of Second Digit Is:"<<b*b<<endl;
}
if(choice==8)
{
int a,i,c=1;
cout<<"PERMUTATION\n";
cout<<"\nEnter First Digit:";
cin>>a;
for(i=1;i<=a;i++)
{
c=c*i;
}
cout<<"The PERMUTATION Is:"<<c<<endl;
}
if(choice==9)
{
cout<<"\nTIGNOMETRIC FUNCTION\n\n";
function();
}
if(choice==10)
{
int c=1,a,b;
cout<<"POWER\n";
cout<<"\nEnter Base Digit:";
cin>>a;
cout<<"\nEnter Power Digit:";
cin>>b;
for(int i=1;i<=b;i++)
{
c=a*c;
}
cout<<"The POWER Is:"<<c<<endl;
}
if(choice==11)
{
float c;
cout<<"CEIL\n";
cout<<"\nEnter The Digit:";
cin>>c;
cout<<"The CEIL Is"<<ceil(c)<<endl;
}
if(choice==12)
{
float c;
cout<<"ABS\n";
cout<<"\nEnter First Digit:";
cin>>c;
cout<<"The ABS Is:"<<abs(c)<<endl;
}
if(choice==13)
{
float c;
cout<<"FLOOR\n";
cout<<"\nEnter The Digit:";
cin>>c;
cout<<"The FLOOR Is:"<<floor(c)<<endl;
}
if(choice==14)
{
exit (0);
}
goto start;
getch();
}