All pastes #417917 Raw Edit

Unnamed

public text v1 · immutable
#417917 ·published 2007-03-31 08:28 UTC
rendered paste body
#include <cstdlib>
#include <iostream>
#define PI 3.141592

using namespace std;
int main(int argc, char *argv[])
{
 	/*
 	 chodzi o to &#380;e  dla:
	 		k=0        x
			k=1        x-(x^3/3!)
			k=2        x-(x^3/3!)+(x^5/5!)
			k=3        x-(x^3/3!)+(x^5/5!)-(x^7/7!)
			.
            . 	
 	        .
 	        
 	        
 	*/
 	float x;
 	cout<<"podaj x ";
 	cin>>x;
        
   
                       // konwersja na radiany
    while (x>=360)
    {
    x=x-360;
    }
			
    x=x*PI/180;        
                      //------------------------

    float wynik=x;
    float w=x;
    int k=1;
    int z=1;
    while(k/2<=1000) 
    {
	    		   
	  z=z*-1;
      k+=2;
	  w=(w*x*x)/(k*(k-1));	
	  wynik+=w*z;

	   } 

    printf("\n\n wynik : %f \n",wynik);
    
    system("PAUSE");
    return EXIT_SUCCESS;
    }