If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Can somebody help me with programming in C++?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-11-06, 06:08
majagaja majagaja is offline
Registered User
 
Join Date: Mar 2006
Posts: 2
Red face Can somebody help me with programming in C++?

I have to create the programm which calculate sinus by using the theory of Taylor series.
I have already something done but is probably wrong...
There it is:
*****************************************
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

const PI = 3.14;
double tolerance = 0.00001;
double y = 0.0;
double f = 1.0; //factorial
int i = 0;
double oldy;
int x;
double pom,co;

void main(void)
{
printf("Type the angle's value");
scanf("%d",&x);

do
{
oldy = y;
y = y + (((pow(-1,i))* (pow(x*PI/180,(2*i+1))))/f);
f = (2*i + 2)*(2*i +3)*f;
i = i + 1;
pom = abs(y - oldy);
}
while (pom > tolerance);
printf("a%d",y);
****************************************
I don't know what to do with this...
Thanks for help....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On