Skip to content

Commit

Permalink
AA
Browse files Browse the repository at this point in the history
  • Loading branch information
icebowl committed Apr 8, 2019
1 parent ac77829 commit 808f934
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sin0.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// g++ sin0.cpp -o sin0.o
#include <iostream>
#include <cmath>
using namespace std;
int main (){
double PI=3.14159265358979323846;
double t, result=0;
for ( t=0 ; t<=360 ; t = t + 15 )
{
result += sin(t);
cout <<t<<"\t"<< result<<endl;
}
return 0;
}
15 changes: 15 additions & 0 deletions sin1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// g++ sin1.cpp -o sin1.o
#include <iostream>
#include <cmath>
using namespace std;
int main (){
double PI=3.14159265358979323846;
double d,t, sine_of_t=0; //d degrees , t theta
for ( d=0 ; d<=360 ; d = d + 15 )
{
t =( d * PI / 180.0);
sine_of_t = sin(t);
cout <<t<<" "<<d<<"\t"<< sine_of_t<<endl;
}
return 0;
}
25 changes: 25 additions & 0 deletions sin3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// g++ sin1.cpp -o sin1.o
#include <iostream>
#include <cmath>
using namespace std;


double round4(double var)
{
double value = (int)(var * 10000 + 0.0005);
return (double)value / 10000;
}


int main (){
double PI=3.14159265358979323846;
double d,t, sine_of_t=0; //d degrees , t theta
for ( d=0 ; d<=360 ; d = d + 15 )
{
t =( d * PI / 180.0);
sine_of_t = sin(t);
sine_of_t = round4(sine_of_t);
cout <<t<<" "<<d<<"\t"<< sine_of_t<<endl;
}
return 0;
}

0 comments on commit 808f934

Please sign in to comment.