Combining Functions
- From: Nutkin <Nutkin.2h6zxt@xxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 12 Nov 2006 21:15:36 -0600
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
------------------------------------------------------------------------
.
- Follow-Ups:
- Re: Combining Functions
- From: David Wilkinson
- Re: Combining Functions
- From: Ben Voigt
- Re: Combining Functions
- From: Bruno van Dooren [MVP VC++]
- Re: Combining Functions
- Prev by Date: Re: Two VS2005 C++ compiler bugs in few simple lines of code...
- Next by Date: query regarding printer drivers
- Previous by thread: Re: C Runtime Error R6034
- Next by thread: Re: Combining Functions
- Index(es):
Relevant Pages
|