Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. setlocale(LC_ALL, "RU");
  8. char str[150];
  9. int i = 0,tru=0, chet=0,max=0;
  10. gets_s(str);
  11. while (str[i] != '\0')
  12. {
  13. while (str[i] == ' ')
  14. {
  15. i++;
  16. chet = 0;
  17. }
  18. while (str[i] != '\0' && str[i] != ' ')
  19. {
  20. tru=isdigit(str[i]);
  21. i++;
  22. if (tru == 4 ) {
  23. chet++; }
  24. else {
  25. chet = 0;
  26. if (str[i] != '-') { }
  27. else{ chet = 0; }
  28. }
  29. if (max < chet) {
  30. max = chet;
  31. }
  32. }
  33. }
  34. cout << "наибольшее количество идущих подряд цифр: " << max << endl;
  35.  
  36. system("pause");
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement