Advertisement
Pafnytiu

строки 4 -6

Dec 7th, 2015
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6. string line;
  7. cout << "Enter numbers: ";
  8. getline(cin, line);
  9. string::size_type k = 0, maxLine = 0, lineLen = line.length();
  10. for(unsigned int i = 0; i != lineLen; ++i)
  11. {
  12. if (isdigit(line[i]))
  13. ++k;
  14. else
  15. {
  16. if (k > maxLine)
  17. maxLine = k;
  18. k = 0;
  19. }
  20. }
  21. if (k > maxLine)
  22. maxLine = k;
  23. cout <<"Max Line: " << maxLine << endl;
  24. system ("pause");
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement