logo
Шпора по информатике / 002

Void main ( ) {

float x, step; int k, N;

N=7; step = M_PI / (N-1); // или 3.141593

for (k=0; k<N; k++)

{x = step*k;

cout<<" k=" << k <<"\t x="<<x <<"\t sin(x)="<<sin(x)<<endl; }

getch( ); }

// - - - - - - - - - - - -

Способ 2 – ООП, т.е. с классом.

#include <iostream.h>

#include <math.h>

#include <conio.h>

class tabsin { // класс

private: float step; / / поле класса

public: float x; int N ; / / поля класса