Laitofai

3c

Nov 20th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. //#3c
  2. #include <iostream>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. ifstream fileInput("input.txt");
  10. if(fileInput.is_open() == 0){
  11. cout << "FILE NOT FOUND! CREATE IT BY YOURSELF";
  12. return 0;
  13. }
  14. int shag, pred, tek;
  15. fileInput >> pred >> tek;
  16. shag = tek - pred;
  17. pred = tek;
  18. while(fileInput >> tek){
  19. if(shag != tek - pred){
  20. cout << "Eto ne arithmetic progressiya >_<";
  21. return 0;
  22. }
  23. pred = tek;
  24. }
  25. cout << "Eto arithmetic progression ^_^";
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment