You are on page 1of 12

WACHEMO UNIVERSITY

COLLEGE OF ENGINEERING AND TECHNOLOGY

SCHOOL OF COMPUTING AND INFORMATICS

DEPARTMENT OF INFORMATION TECHNOLOGY

Course Title- Programming II

Scientific Calculator Assignment


Group three

Name ID

1) Akalu Abebe 000706


2) Yosef Tadese---------------------------------------000927
3) Firehiwot ----------------------------------000841
4) Getachew Wondeson------------------------------000802
5) Semrden kedir-----------------------------------------000924
6) Abdrezak Mohe-----------------------------------------000683

Submitted to Kibrom.

Submission date 28/09/10


Scientific Calculator C++ program

#include<iostream>

#include<math.h>

using namespace std;

void Wellcome();

void standard_operation();

void trigonometry_functions();

void logarithm_functions();

void exponential_functions();

void factorial_expression();

void hypotness_finding();

void unit_converter();

int main ()

int x,y;

do{

Wellcome();

cout<<"please enter your choise "<<endl;

cin>>x;

switch(x)

case 1:

standard_operation();
break;

case 2:

trigonometry_functions();

break;

case 3:

logarithm_functions();

break;

case 4:

exponential_functions();

break;

case 5:

factorial_expression();

break;

case 6:

hypotness_finding();

break;

case 7:

unit_converter();

break;

default:

cout<<"incorrect input";

break;

while(x!=8);
return 0;

void Wellcome()

cout<<"|================================================================|\n\n";

cout<<"|*************************** Wellcome ***************************|\n";

cout<<"|================================================================|\n\n";

cout<<"|******************** scientific_calculator *********************|\n\n";

cout<<"|***************** program II scientic calculator project *******|\n\n";

cout<<"|**************************** GROUP FIVE ************************|\n";

cout<<"|================================================================|\n\n";

cout<<"press 1 for standard operations"<<endl;

cout<<"press 2 for trigonometric functions"<<endl;

cout<<"press 3 for logarithmic functions"<<endl;

cout<<"press 4 for exponential functions"<<endl;

cout<<"press 5 for factorial"<<endl;

cout<<"press 6 for geting hypotness"<<endl;

cout<<"press 7 to unit converter "<<endl;

cout<<"press 8 to exit"<<endl;

void standard_operation()

int a,b;
char op;

cout<<"please enter the first number"<<endl;

cin>>a;

cout<<"please enter the oprater"<<endl;

cin>>op;

cout<<"please enter second number"<<endl;

cin>>b;

switch(op)

case '+':

cout<<"Addition = "<<a+b<<endl;

break;

case '-':

cout<<"Subtraction = "<<a-b<<endl;

break;

case '*':

cout<<"Multiplication = "<<a*b<<endl;

break;

case '/':

cout<<"Division = "<<a/b<<endl;

break;

case '%':

cout<<"Addition = "<<a%b<<endl;

break;

default:
cout<<"Wrong Input"<<endl;

void trigonometry_functions()

int x,op,PI=3.14159265;

cout<<"press 1 for sine"<<endl;

cout<<"press 2 for cosine"<<endl;

cout<<"press 3 for tangent"<<endl;

cout<<"press 4 for arc sine"<<endl;

cout<<"press 5 for arc cosine"<<endl;

cout<<"press 6 for arc tangent"<<endl;

cout<<"press 7 for Inverse of sine"<<endl;

cout<<"press 8 for Inverse of cosine"<<endl;

cout<<"press 9 for Inverse of tangent"<<endl;

cin>>op;

cout<<"please enter the number"<<endl;

cin>>x;

//cout<<"please enter the number"<<endl;

//cin>>x;

switch(op)

case 1:

cout<<"Sin = "<<sin(x)<<endl;
break;

case 2:

cout<<"Cos = "<<cos(x)<<endl;

break;

case 3:

cout<<"Tan = "<<tan(x)<<endl;

break;

case 4:

cout<<"Sin = "<<asin(x)<<endl;

break;

case 5:

cout<<"Cos = "<<cos(x)<<endl;

break;

case 6:

cout<<"Tan = "<<tan(x)<<endl;

break;

case 7:

cout<<"Inverse of sin = "<<asin(x)*180.0/PI<<endl;

break;

case 8:

cout<<"Inverse of cos = "<<acos(x)*180.0/PI<<endl;

break;

case 9:

cout<<"Inverse of tan = "<<atan(x)*180.0/PI<<endl;

break;
default:

cout<<"Wrong Input"<<endl;

void logarithm_functions()

int a,op;

cout<<"press 1 for normal logarithm"<<endl;

cout<<"press 2 for logarithm with base 10"<<endl;

cin>>op;

cout<<"please enter the number"<<endl;

cin>>a;

switch(op)

case 1:

cout<<"Log = "<<log(a)<<endl;

break;

case 2:

cout<<"Log with base 10 = "<<log10(a)<<endl;

break;

default:

cout<<"Wrong Input"<<endl;

void exponential_functions()
{

int a,b,op,x;

cout<<"press 1 for power"<<endl;

cout<<"press 2 for e the power of constant"<<endl;

cout<<"press 3 square root"<<endl;

cout<<"press 4 for cube root"<<endl;

cin>>op;

switch(op)

case 1:

cout<<"please enter first number"<<endl;

cin>>a;

cout<<"please enter second number"<<endl;

cin>>b;

cout<<"Exponent = "<<pow(a,b)<<endl;

break;

case 2:

cout<<"please enter the number"<<endl;

cin>>x;

cout<<"e the power of constant= "<<exp(x)<<endl;

break;

case 3:

cout<<"please enter the number"<<endl;

cin>>x;

cout<<"Square Root = "<<sqrt(x)<<endl;


break;

case 4:

cout<<"please enter the number"<<endl;

cin>>x;

cout<<"Square Root = "<<cbrt(x)<<endl;

break;

default:

cout<<"Wrong Input"<<endl;

void factorial_expression()

int f;

int n=1;

cout<<"please enter the number"<<endl;

cin>>f;

for(int i=f;i>1;i--)

n=n*i;

cout<<"The factorial of "<<f<<" is :"<<n<<endl;

void hypotness_finding()

{int x,y;

cout<<"please enter the first number"<<endl;


cin>>x;

cout<<"please enter the second number"<<endl;

cin>>y;

cout<<"The hypotness of "<<x<<" and "<<y<<" is :"<<hypot(x,y)<<endl;

void unit_converter()

int op;

float u,d;

cout<<"press 1 : Km to meter"<<endl;

cout<<"press 2 : Meter to Km"<<endl;

cout<<"press 3 : km to mile"<<endl;

cout<<"press 4 : Mile to Km"<<endl;

cout<<"press 5 : Meter to cm"<<endl;

cout<<"press 6 : cm to meter"<<endl;

cin>>op;

cout<<"please enter the number"<<endl;

cin>>d;

u=1.609344;

switch(op)

case 1:

cout<<d<<"km is eqal to "<<(d*1000)<<"meter"<<endl;

break;

case 2:
cout<<d<<"meter is eqal to "<<(d/1000)<<"km"<<endl;

break;

case 3:

cout<<d<<"km is eqal to "<<(d/u)<<"miles"<<endl;

break;

case 4:

cout<<d<<"mile is eqal to "<<(d*u)<<"km"<<endl;

break;

case 5:

cout<<d<<" meter is eqal to "<<(d*100)<<"cm"<<endl;

break;

case 6:

cout<<d<<"cm is eqal to "<<(d/100)<<"meter"<<endl;

break;

default:

cout<<"Wrong Input"<<endl;

You might also like