fork(4) download
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. double vals[360];
  8. for (int i = 0; i < 360; i++) {
  9. vals[i] = sin(M_PI/360*i);
  10. }
  11.  
  12. int tmp;
  13. cin >> tmp;
  14. cout << "sin("<<tmp<<")="<<vals[tmp%360]<<"\n"
  15. "cos("<<tmp<<")="<<vals[(tmp-90)%360]<<"\n"
  16. "diff: " << (sin(tmp)-cos(tmp))<<"\n";
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 2728KB
stdin
Standard input is empty
stdout
sin(134515241)=0.986286
cos(134515241)=0.580703
diff: 0.821537