Advertisement
Mike_be

Individual Homework

Nov 5th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <cmath>
  4. #define M_PI 3,1415926535
  5. using namespace std;
  6.      
  7. int main()
  8. {
  9.     long double angle = 0;
  10.     int i = 1, n, x = 0, y = 0;
  11.     ifstream input;
  12.     input.open("INPUT.txt");
  13.     input >> n;
  14.     input.close();
  15.     ofstream output;
  16.     output.open("OUTPUT.txt");
  17.     if (n>0 && n<=300) {
  18.       output << "YES" << endl;
  19.       while (i <= n) {
  20.         x = cos(angle) * 10000;
  21.         y = sin(angle) * 10000;
  22.         output << x << ' ' << y << endl;
  23.         angle += (2 *M_PI) / (n+1);
  24.         ++i;
  25.       }
  26.     }
  27.     else output << "NO" << endl;
  28.     output.close();
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement