Advertisement
Guest User

Untitled

a guest
Jul 15th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <string>
  3. #include <cstring>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. bool same = true;
  9. int i = 0;
  10. while (same)
  11. {
  12. stringstream ss;
  13. ss << i;
  14. string seed = ss.str();
  15. system(("gen.exe " + seed + "> test.in").c_str());
  16. system("good.exe < test.in > out1.out"); //system("./good < test.in > out1");
  17. system("mine.exe < test.in > out2.out"); //system("./mine < test.in > out1");
  18. ifstream cin1("out1");
  19. ifstream cin2("out2");
  20. string A,B;
  21. while (getline(cin1,A))
  22. {
  23. getline(cin2,B);
  24. if (A != B)
  25. {
  26. same = false;
  27. break;
  28. }
  29. }
  30. if (same)
  31. {
  32. cout << ++i << ". OK!\n";
  33. }
  34. else
  35. {
  36. ifstream cin3("test.in");
  37. string X;
  38. while (getline(cin3,X)) cout << X << "\n";
  39. }
  40. }
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement