Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <locale>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "RU");
- char str[150];
- int i = 0,tru=0, chet=0,max=0;
- gets_s(str);
- while (str[i] != '\0')
- {
- while (str[i] == ' ')
- {
- i++;
- chet = 0;
- }
- while (str[i] != '\0' && str[i] != ' ')
- {
- tru=isdigit(str[i]);
- i++;
- if (tru == 4 ) {
- chet++; }
- else {
- chet = 0;
- if (str[i] != '-') { }
- else{ chet = 0; }
- }
- if (max < chet) {
- max = chet;
- }
- }
- }
- cout << "наибольшее количество идущих подряд цифр: " << max << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement