Professional Documents
Culture Documents
TERMWORK
TERMWORK
CODE:
#include <iostream>
#include <string.h>
#include <conio.h>
#include <math.h>
class Scientific_cal
public:
float a,b;
int z;
void body()
float p;
p = pow(x,y);
cout<<"\t\tPower: "<<p;
}
void Sine(float x)
float s;
s = sin(x);
cout<<"\t\tSin: "<<s;
void Square(float x)
float sq;
sq = sqrt(x);
void Cos(float x)
float c;
c = cos(x);
cout<<"\t\tCOS: "<<c;
void Tan(float x)
{
float t;
t = tan(x);
cout<<"\t\tTAN: "<<t;
void Log(float x)
float l;
l = log(x);
void Baselog(float x)
float bl;
bl = log10(x);
};
class Simple_calc
public:
void Body()
{
cout << "\t\t Simple calculator opened..!! \n" << endl;
int ans = x + y;
return ans;
int ans = x - y;
return ans;
int ans = x * y;
return ans;
int ans = x / y;
return ans;
};
class factorial{
int f, n;
public:
void fact()
f=1;
cout<<"\n\t\tEnter a Number:";
cin>>n;
for(int i=1;i<=n;i++)
f=f*i;
void display()
};
void scientific()
Scientific_cal key;
key.body();
int z;
float a;
float b;
cout<<"\t\t **************************************\n"<<endl;
cin>>z;
switch(z)
case 1:
cin>>a;
cout<<endl;
cin>>b;
key.Power(a,b);
break;
case 2:
cout<<"\t Enter the Number for Calculating SIN: ";
cin>>a;
key.Sine(a);
break;
case 3:
cin>>a;
key.Square(a);
break;
case 4:
cin>>a;
key.Cos(a);
break;
case 5:
cin>>a;
key.Tan(a);
break;
case 6:
key.Log(a);
break;
case 7:
cin>>a;
key.Baselog(a);
break;
cout<<endl;
cout<<"\t\t Do you want to continue with scientific calc ? (y/n | Y/N) ";
char ch;
cin>>ch;
scientific();
else
return;
void simple()
{
int func;
int x, y;
Simple_calc key;
key.Body();
switch(func)
case 1: //Addition
cin >> x;
cout<<endl<<"\t\t";
break;
case 2: //Subtraction
cin >> x;
cin >> y;
cout<<endl<<"\t\t";
break;
case 3: //Multiplication
cin >> x;
cin >> y;
cout<<endl<<"\t\t";
case 4: //Division
cin >> x;
cin >> y;
cout<<endl<<"\t\t";
break;
default:
break;
cout<<endl;
cout<<"\t\t Do you want to continue with simple calc ? (y/n | Y/N) ";
char ch;
cin>>ch;
simple();
else
return;
}
void fact()
factorial ob;
ob.fact();
ob.display();
int main()
int n;
cout<<endl;
cout<<"\t\t ***************MENU*****************\n";
cout<<"\t\t ************************************\n";
cin>>n;
switch(n)
case 1:
scientific();
break;
case 2:
simple();
break;
case 3:
fact();
break;
case 4:
break;
default:
return 0;
}
OUTPUT:
1.
2.
3.
4.
5.
6.