Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int n;
- cout << "введите число элементов" << endl;
- cin >> n;
- cin.clear();
- char *a = new char[n+1];
- int L = 0;
- char cBuffer;
- int iBuffer;
- int count = 0;
- int counter = 0;
- int nomerMax = 0;
- gets_s(a, n+1);
- cin.getline(a, n+1);
- int stroka = 0;
- for (int i = 0; i < strlen(a); i++)
- {
- while (a[i] == 48 || a[i] == 49 || a[i] == 50 || a[i] == 51 || a[i] == 52 || a[i] == 53 || a[i] == 54 || a[i] == 55 || a[i] == 56 || a[i] == 57)
- i++;
- L = i;
- while (!((a[i] == 48) || (a[i] == 49) || (a[i] == 50) || (a[i] == 51) || (a[i] == 52) || (a[i] == 53) || (a[i] == 54) || (a[i] == 55) || (a[i] == 56) || (a[i] == 57)))
- {
- if (i == strlen(a))
- break;
- i++;
- }
- if (L < i)
- stroka++;
- }
- cout << "строк разбито: " << stroka << endl;
- char **massivPodstrok = new char*[stroka];
- int markerStrok = 0;
- int maxSize = 0;
- for (int i = 0; i < strlen(a); i++)
- {
- while (a[i] == 48 || a[i] == 49 || a[i] == 50 || a[i] == 51 || a[i] == 52 || a[i] == 53 || a[i] == 54 || a[i] == 55 || a[i] == 56 || a[i] == 57)
- i++;
- L = i;
- while (!((a[i] == 48) || (a[i] == 49) || (a[i] == 50) || (a[i] == 51) || (a[i] == 52) || (a[i] == 53) || (a[i] == 54) || (a[i] == 55) || (a[i] == 56) || (a[i] == 57)))
- {
- if (i == strlen(a))
- break;
- i++;
- }
- int h = 0;
- for (int I = L; I < i; I++)
- {
- h++;
- if (maxSize < h)
- {
- maxSize = h;
- nomerMax = count;
- }
- }
- massivPodstrok[count] = new char[h];
- count++;
- }
- cout << "максимальная длина строки " << maxSize << endl;
- cout << "номер строки максимальной длины: " << nomerMax +1 << endl;
- count = 0;
- for (int i = 0; i < strlen(a)+1; i++)
- {
- while (a[i] == 48 || a[i] == 49 || a[i] == 50 || a[i] == 51 || a[i] == 52 || a[i] == 53 || a[i] == 54 || a[i] == 55 || a[i] == 56 || a[i] == 57)
- i++;
- L = i;
- while (!((a[i] == 48) || (a[i] == 49) || (a[i] == 50) || (a[i] == 51) || (a[i] == 52) || (a[i] == 53) || (a[i] == 54) || (a[i] == 55) || (a[i] == 56) || (a[i] == 57)))
- {
- if (i == strlen(a))
- break;
- i++;
- }
- int h = 0;
- for (int I = L; I < i; I++)
- {
- iBuffer = a[I];
- cBuffer = (char)iBuffer;
- if (count < stroka)
- {
- massivPodstrok[count][h] = cBuffer;
- cout << massivPodstrok[count][h];
- }
- h++;
- }
- cout << endl;
- count++;
- }
- cout << count;
- for (int i = 0; i < stroka; i++)
- delete massivPodstrok[i];
- delete[] massivPodstrok;
- delete[] a;
- _getch();
- return 0;
- }`
- delete[] massivPodstrok[i]
- massivPodstrok[count] = new char[h];
- while (a[i] == 48 || a[i] == 49 || a[i] == 50 || a[i] == 51 || a[i] == 52 || a[i] == 53 || a[i] == 54 || a[i] == 55 || a[i] == 56 || a[i] == 57)
- i++;
- if(a[i] == 48 || a[i] == 49 || a[i] == 50 || a[i] == 51 || a[i] == 52 || a[i] == 53 || a[i] == 54 || a[i] == 55 || a[i] == 56 || a[i] == 57)
- continue;
- #include <cctype>
- // ...
- if(std::isdigit(a[i]))
- for (int i = 0, len = strlen(a); i < len; i++)
- {
- if(std::isdigit(a[i])) continue;
- L = i;
- while (!std::isdigit(a[i]))
- {
- if (i == len)
- break;
- i++;
- }
- if (L < i)
- stroka++;
- }
- cin >> n;
Add Comment
Please, Sign In to add comment