Advertisement
Guest User

код

a guest
Oct 20th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. #include <stdio.h>
  4. int main()
  5. {
  6.     char stroka[100], t;
  7.     char * pch;
  8.     int i, j, n;
  9.     printf("Vvedite stroku ");
  10.     gets(stroka);
  11.     n = strlen(stroka);
  12.     for (i = 0; i < n - 1; i++)
  13.     {
  14.         if (isdigit(stroka[i]))
  15.         {
  16.  
  17.             for (i = 0; i < n - 1; i++)
  18.             {
  19.                 for (j = 0; j<n - i - 1; j++)
  20.                 {
  21.                     if (stroka[j]>stroka[j + 1])
  22.                     {
  23.                         t = stroka[j];
  24.                         stroka[j] = stroka[j + 1];
  25.                         stroka[j + 1] = t;
  26.                     }
  27.                 }
  28.             }
  29.         }
  30.     }
  31.  
  32.         printf("Splitting string \"%s\" into tokens:\n", stroka);
  33.         pch = strtok(stroka, " ");
  34.         while (pch != NULL)
  35.         {
  36.             printf("%s\n", pch);
  37.             pch = strtok(NULL, " ,.-");
  38.         }
  39.         printf("Stroka po vozrastaniy:");
  40.         printf("%s", stroka);
  41.         system("pause");
  42.         return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement