Advertisement
CosminVarlan

Untitled

Apr 13th, 2021
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. ifstream fin("medii.txt");
  7.  
  8.  
  9. int contor=0;
  10.  
  11. int cifra(float x, int &y){
  12. y = ((int)x)%10;
  13. }
  14.  
  15.  
  16. int main()
  17. {
  18. int y;
  19. cifra(123.45, y);
  20.  
  21. double a, b;
  22. while(fin >> a >> b)
  23. {
  24. int y1,y2;
  25. cifra(a,y1);
  26. cifra(b,y2);
  27. if (y1+1==y2) contor++;
  28. }
  29.  
  30. cout << contor << endl;
  31. return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement