Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string a,b;
  9. ifstream plik;
  10. plik.open("C:\\Users\\R_informatyka\\Desktop\\Dane1.txt");
  11. int wynik=0;
  12. for(int i=0;i<500;i++)
  13. {
  14. plik>>a;
  15. if (a.length()==2)
  16. {
  17. if(a[1]>=a[0]) wynik=wynik+1;
  18. }
  19.  
  20. if (a.length()==3)
  21. {
  22. if(a[2]>=a[1]>=a[0]) wynik=wynik+1;
  23. }
  24. if (a.length()==4)
  25. {
  26. if(a[3]>=a[2]>=a[1]>=a[0]) wynik=wynik+1;
  27. }
  28.  
  29. }
  30. cout<<wynik;
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement