sobota, 23 kwietnia 2022

Trigonometric - continue (C++)

 #include <iostream>

#include <math.h>

#include <fstream>

#define a 8


using namespace std;



double date[a]={0.00,30.00,45.00,60.00,90.00,180.00,270.00,360.00};


double f_Rad(double value)

{

return (value*3.14159265359)/180.00;

}

double msin[a],mcos[a],mtg[a],mctg[a];


int main(int argc, char **argv)

{

int i;

for(i=0;i<a;i++)

{

msin[i]=sin(f_Rad(date[i]));

mcos[i]=cos(f_Rad(date[i]));

mtg[i]=msin[i]/mcos[i];

mctg[i]=1.00/mtg[i];

}

fstream file("table.txt",ios::out);

if(file.good())

{

file<<"sin: 0,30,45,60,90,180,270,360\n";

for(i=0;i<a;i++)

{

file<<msin[i]<<"  ";

}

file<<"\n";

file<<"cos: 0,30,45,60,90,180,270,360\n";

for(i=0;i<a;i++)

{

file<<mcos[i]<<"  ";

}

file<<"\n";

file<<"tg: 0,30,45,60,90,180,270,360\n";

for(i=0;i<a;i++)

{

file<<mtg[i]<<"  ";

}

file<<"\n";

file<<"ctg: 0,30,45,60,90,180,270,360\n";

for(i=0;i<a;i++)

{

file<<mctg[i]<<"  ";

}

file<<"\n";

file.close();

}

return 0;

}


Brak komentarzy:

Prześlij komentarz