Siwy_Krzysiek

Matura 2014 Ciekawe napisy B

Dec 20th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. bool rosnie(string slowo);
  8.  
  9. int main()
  10. {
  11.     ifstream dane("NAPIS.TXT");
  12.     string slowo;
  13.  
  14. //    cout << rosnie("ABB") << endl;
  15.  
  16.     while(!dane.eof())
  17.     {
  18.         dane >> slowo;
  19.         if(rosnie(slowo))
  20.             cout << slowo << endl;
  21.     }
  22.  
  23.     return 0;
  24. }
  25.  
  26. bool rosnie(string slowo)
  27. {
  28. //    bool wynik=true;
  29.  
  30.     for(int i=1; i<slowo.size(); i++)
  31.     {
  32.         if(slowo[i]<=slowo[i-1])
  33.             return false;
  34.     }
  35.  
  36.     return true;
  37. }
Add Comment
Please, Sign In to add comment