Combining Functions

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Hi i have to program a code to perform 1 of 5 functions at the users
request, I have got to the part where i have to program the equations
and i cant seem to get them to link together. Basicly when the used
enters his radians i was to link to a sin x function to calculate the
sin of the number also there will be a factorial function and a cos
function. but none of them are linking.

#include <iostream>

using namespace std;

int factorial()
{
int i=0;
for (i=0; i>0; i--)


return 0;
}




double sin()
{
double sin=0;
double x=0;

sin=x-(x*x*x/(3*2*1))+(x*x*x*x*x/(5*4*3*2*1));

return sin;
}

int main()
{
int item=0;
double x=0;
double pi=3.14159265;

cout <<"Please enter your x value in radians : ";
cin >> x;

cout <<"Select the Equation to Perform:";
cout <<"\n";
cout <<"1 = sin(x)\n";
cout <<"2 = cos(x)\n";
cout <<"3 = tan(x)\n";
cout <<"4 = sin^2(x) + cos^2(x)\n";
cout <<"5 = 2sin(x)cos(x)\n";
cout <<"Enter the Number: ";
cin >> item;

switch (item){
case 1:
cout <<sin();
cout <<"\n\n\n";
break;
case 2:
cout << "Case 2\n\n";
break;

case 3:
cout << "case 3\n\n";
break;
case 4:
cout << "case 4\n\n";
break;
case 5:
cout << "case 5\n\n";
break;
default:
cout <<"No Number Entered";
break;
}


return 0;
}



--
Nutkin
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

.



Relevant Pages

  • Re: [ANNOUNCE] System Inactivity Monitor v1.0
    ... this options lets you to specify how much frequently SIN should be ... static struct timer_list timer; ... static int shutdown; ...
    (Linux-Kernel)
  • Re: Simple and safe evaluator
    ... a few more funcs like int() and sin(). ... # expose selected math constants and functions ... I'm assuming that the _ast definitions are buried in the C part of python, but that is just a silly guess. ...
    (comp.lang.python)
  • Re: sizeof and strlen()
    ... because it was the correct tool for the job. ... I'm having trouble figuring out what those beliefs might have been. ... Then sqrtor sin() would work. ... The int isn't big enough. ...
    (comp.lang.c)
  • Re: Simple and safe evaluator
    ... a few more funcs like int() and sin(). ... just populate the globals dict with the names ... # expose selected math constants and functions ...
    (comp.lang.python)
  • Re: Combining Functions
    ... enters his radians i was to link to a sin x function to calculate the ... sin of the number also there will be a factorial function and a cos ... int factorial() ... cin>> item; ...
    (microsoft.public.dotnet.languages.vc)