Advertisement
sve_vash

Untitled

Jan 10th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. int main()
  2. {
  3.  
  4.  
  5. #if 0
  6. ofstream output_file("input.txt");
  7. for (int i = 0; i < 2000000; i++) {
  8. output_file << static_cast<char>('a' + rand() % 26);
  9. }
  10. #else
  11. ifstream input_file("input.txt");
  12.  
  13. ofstream output_file("output.txt");
  14. string s;
  15. input_file >> s;
  16. string s2 = s;
  17.  
  18. time_meter tm;
  19. ___CaesarEncryptOneThread___(&s2);
  20. const double one_thread_result = tm.seconds();
  21.  
  22. tm.restart();
  23. CaesarEncrypt(&s);
  24. const double result = tm.seconds();
  25.  
  26.  
  27. const double x = result / one_thread_result;
  28.  
  29.  
  30.  
  31.  
  32. if (x > 0.75)
  33. output_file << "So sloooooow\n\n" << "time / time_one_thread = " << result << " " << one_thread_result << endl;
  34. else
  35. output_file << "\n\ncool nice\n\n" << result << " " << one_thread_result << endl;
  36.  
  37. return 0;
  38.  
  39. #endif
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement