How to Make a Full-Out Calculator
May 11, 2011 at 12:56am UTC
First start with
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include <cstdlib>
#include <iostream>
#include <math.h>
using namespace std;
//Basic Functions
double basfunc(double x, double y)
{
double sum, dif, pro, quo ; //add, subtract, multiply, divide
sum=x+y ;
dif=x-y ;
pro=x*y ;
quo=x/y ;
int operb ;
cout<<"Enter an operation. 1-add, 2-subtract, 3-multiply, 4-divide." <<endl ;
cin>> operb ; //operation basic
switch (operb)
{
case 1:
cout<<sum <<endl ;
break ;
case 2:
cout<<dif <<endl ;
break ;
case 3:
cout<<pro <<endl ;
break ;
case 4:
cout<<quo <<endl ;
break ;
}
}
//we will add int main() later
Last edited on May 11, 2011 at 12:58am UTC
May 11, 2011 at 1:02am UTC
Next we will make the "Next" functions
1 2 3 4 5 6 7 8
//Next Functions
double nextfunc(double x_2, double y_2)
{
double sqrx=x_2*x_2 ; //x squared
double sqrtx=sqrt(x_2) ; //square root of x
double cubx=sqrx*x_2 ; //x cubed
//got to go this is where we will do cube roots
}
Last edited on May 11, 2011 at 1:06am UTC
Topic archived. No new replies allowed.