Advertisement
Guest User

cpp-dely

a guest
Apr 7th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.33 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. // Example program
  10. #include <iostream>
  11. #include <string>
  12. #include "stdio.h"
  13. #include "math.h"
  14.  
  15. using namespace std;
  16.  
  17. int main()
  18. {
  19.   float valSin, valCos, valTan;
  20.   int deg = 0;
  21.  
  22.   // tampilan awal table
  23.   // cout tabnya lebih oke
  24.   //   cout << "deg\t\t" << "sin(x)\t\t" << "cos(x)\t\t" << "tan(x)\t\t" << "\n";
  25.   printf("deg       sin(x)        cos(x)        tan(x)");
  26.   cout << "\n";
  27.  
  28.   while (deg <= 360)
  29.   {
  30.    
  31.     if (deg % 25 == 0 && deg > 0)
  32.     {
  33.         cin.get();
  34.     }
  35.    
  36.     // memasukkan nilai ke var
  37.     valSin = ceil(sin(deg) * 100.0) / 100.0;
  38.     valCos = ceil(cos(deg) * 100.0) / 100.0;
  39.     valTan = ceil(tan(deg) * 100.0) / 100.0;
  40.    
  41.     // tampilan dinamis per row
  42.     // cout <<  deg << "\t\t" << valSin << "\t\t" << valCos << "\t\t" << valTan << "\n";
  43.     printf("%i       %.2f        %.2f        %.2f", deg, valSin, valCos, valTan);
  44.     cout << "\n";
  45.    
  46.     deg += 1; // biar deg nambah dan ga bootloop
  47.   }
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement