#include <iostream>
#include<cmath>
using namespace std;
class Calculator{
public:
float Addition(float x, float y){
float ans = x + y;
return ans;
}
float Subtraction(float x, float y){
float ans = x - y;
return ans;
}
float Multiplication(float x, float y){
float ans = x * y;
return ans;
}
float Division(float x, float y){
float ans = x / y;
return ans;
}
};
class SCalculator : public Calculator
{
public:
float Power(float x, float y){
float ans=1;
for (int i=1; i<=y; i++)
{
ans = ans*x;
}
return ans;
}
float Sin(float angle){
return sin(angle);
}
float Cos(float angle){
return cos(angle);
}
float Tan(float angle){
return tan(angle);
}
float AntiSin(float Value){
return asin(Value);
}
float AntiCos(float Value){
return acos(Value);
}
float AntiTan(float Value){
return atan(Value);
}
float Log(float Num){
return log(Num);
}
float Factorial(float Num){
float fact=1;
for(int i=1; i<=Num; i++){
fact = fact*i;
}
return fact;
}
float Exponantial(float Num){
float e = 2.718281828;
float pow = 1;
for(int i=1; i<=Num; i++){
pow = e*pow;
}
return pow;
}
float Squareroot(float Num){
return sqrt(Num);
}
};
int main() {
Calculator s;
SCalculator S;
int chk,chk2;
float x, y,angle,Num,Value;
cout<<"Welcome to Scientific calculator "<<endl;
cout<<"Input 1 For Normal Arthematic Opreations \n";
cout<<"Input 2 for Other Opreations Like Trignometric and others \n";
cout<<"Input your choice : ";
cin>>chk;
if(chk==1) {
cout << "Input 1 For Addition ";
cout << "Input 2 for subtraction ";
cout << "INOUT 3 FOR MULTILICATION ";
cout << "Input 4 for Division ";
cout<<"Input your choice :";
cin>>chk2;
if(chk2==1){
cout<<"Inout 1st Number : ";
cin>>x;
cout<<"Inout 2nd Number : ";
cin>>y;
cout<<"Your Answer is : ";
s.Addition(x,y);
}
if(chk2==2){
cout<<"Inout 1st Number : ";
cin>>x;
cout<<"Inout 2nd Number : ";
cin>>y;
cout<<"Your Answer is : ";
s.Subtraction(x,y);
}
if(chk2==3){
cout<<"Inout 1st Number : ";
cin>>x;
cout<<"Inout 2nd Number : ";
cin>>y;
cout<<"Your Answer is : ";
s.Multiplication(x,y);
}
if(chk2==4){
cout<<"Inout 1st Number : ";
cin>>x;
cout<<"Inout 2nd Number : ";
cin>>y;
cout<<"Your Answer is ";
s.Division(x,y);
}
}
if(chk==2){
cout<<"\nInput 1 for Sin \n";
cout<<"Input 2 for Cos \n";
cout<<"Inpout 3 for Tan \n";
cout<<"Input 4 for Sin Inverse \n";
cout<<"Input 4 for cos inverser \n";
cout<<"Inoput 5 for Tan Inverse \n";
cout<<"Input 6 for Log \n";
cout<<"Input 7 for Factorial \n";
cout<<"Input 8 for Exponantial \n";
cout<<"Input 9 for Square Root ";
cin>>chk2;
if (chk2==1){
cout<<"Input Angle for SIN : ";
cin>>angle;
cout<<"Your Answer is : ";
S.Sin(angle);
}
else if (chk2==2){
cout<<"Input Angle for COS : ";
cin>>angle;
cout<<"Your Answer is : ";
S.Cos(angle);
}
else if (chk2==3){
cout<<"Input Angle for Tan : ";
cin>>angle;
cout<<"Your Answer is : ";
S.Tan(angle);
}
else if (chk2==4){
cout<<"Input Angle for SIN Inverse : ";
cin>>angle;
S.AntiSin(angle);
cout<<"Your Answer is : ";
S.AntiSin(angle);
}
else if (chk2==5){
cout<<"Input Angle for COS Inverse : ";
cin>>angle;
cout<<"Your Answer is : ";
S.AntiCos(angle);
}
else if (chk2==6){
cout<<"Input Angle for TAN Inverse : ";
cin>>angle;
cout<<"Your Answer is : ";
S.AntiTan(angle);
}
else if (chk2==7){
cout<<"ENter the Value : ";
cin>>Num;
cout<<"Your Answer is : ";
S.Factorial(Num);
}
else if (chk2==8) {
cout<<"Enter value for Expoential : ";
cin>>Num;
cout<<"YOur Answer is : ";
S.Exponantial(Num);
}
else if (chk2==9){
cout<<"Enter Value for Square Root ";
cin>>Num;
cout<<"Your ANswer is : ";
S.Squareroot(Num);
}
else if (chk2==10){
cout<<"Enter the Base for Power : ";
cin>>x;
cout<<"Enter the Power for Base : ";
cin>>y;
cout<<"YOur Answer is : ";
S.Power(x,y);
}
}