Advertisement
allbano

Untitled

Jun 12th, 2025
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | Source Code | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. float to_steps(float angle) {
  6.   return (3200 * 38 / 360.0) * angle;
  7. }
  8.  
  9. int main() {
  10.   int counter = 0;
  11.   float fcounter = 0.0;
  12.   float c2 = 0.0;
  13.  
  14.   for (int k = 0; k < 10; ++k) {
  15.     for (int i = 0; i < 360; ++i) {
  16.       counter += to_steps(i);
  17.       fcounter += to_steps(i);
  18.       c2 += i;
  19.     }
  20.  
  21.     std::cout << "counter = " << counter << '\n';
  22.     std::cout << "fcounter = " << fcounter << '\n';
  23.     std::cout << "c2 = " << c2 << "\n\n";
  24.  
  25.     for (int i = 359; i >= 0; --i) {
  26.       counter -= to_steps(i);
  27.       fcounter -= to_steps(i);
  28.       c2 -= i;
  29.     }
  30.   }
  31.  
  32.   std::cout << "counter = " << counter << '\n';
  33.   std::cout << "fcounter = " << fcounter << '\n';
  34.   std::cout << "c2 = " << c2 << '\n';
  35.   return 0;
  36. }
Tags: C++
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement