DVS_studio

Lab3

Oct 29th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int n = 4;
  5. int tc = 3;
  6. double g = 9.8;
  7. double h = 0.7;
  8. double d = 0.046;
  9. double m[] = { 0.047 + 0.220, 0.047 + 0.220 * 2, 0.047 + 0.220 * 3, 0.047 + 0.220 * 4 };
  10.  
  11. int main() {
  12.     double t;
  13.     for (int i = 0; i < 6; i++) {
  14.         cout << (i + 1) << " r -------------" << endl;
  15.         for (int j = 0; j < n; j++) {
  16.             double dt = 0;
  17.             for (int k = 0; k < tc; k++) {
  18.                 cout << "t" << k + 1 << "   = ";
  19.                 cin >> t;
  20.                 dt += t / tc;
  21.             }
  22.             double E = 4 * h / dt / dt / d;
  23.             double M = m[j] * d / 2 * (g - 2 * h / dt / dt);
  24.             cout << "dT =   " << dt << endl;
  25.             cout << "E  =   " << E << endl;
  26.             cout << "M  =   " << M << endl;
  27.             cout << endl;
  28.         }
  29.     }
  30.     system("pause");
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment