Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <cstdlib>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7.     ofstream fout("out.txt");
  8.     double res;
  9.  
  10.     int n1, n2, n3, a1, a2,i;
  11.  
  12.  
  13.     a1 = clock();
  14.     for ( i = 0; i < 5000000; i++)
  15.     {
  16.         res = sin(i)*cos(pow(i, 4.0)) + sqrt(i) / 6;
  17.         //cout << res;
  18.     //  fout << res;
  19.     }
  20.      = clock();
  21.     n1 = a2 - a1;
  22.     //cout << n1 / CLOCKS_PER_SEC << endl;
  23.     //cin.get();
  24. //  fout << endl << "Опыт 1: " << n1 / CLK_TCK << endl;
  25.  
  26.  
  27. /*  a1 = clock();
  28.     for (int i = 0; i < 100000; i++) {
  29.         res = sin(i)*cos(pow(i, 4.0)) + sqrt(i) / 6;
  30.         cout << res;
  31.     }
  32.     a2 = clock();
  33.     n2 = a2 - a1;
  34.     out << endl << "Опыт 2: " << n2 / CLK_TCK << endl;
  35.  
  36.  
  37.     a1 = clock();
  38.     for (int i = 0; i < 100000; i++) {
  39.         res = sin(i)*cos(pow(i, 4.0)) + sqrt(i) / 6;
  40.         out << res;
  41.     }
  42.     a2 = clock();
  43.     n3 = a2 - a1;
  44.     cout << endl;
  45.     out << "Опыт 3: " << n3 / CLK_TCK << endl;*/
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement