Advertisement
markkoval1999

Untitled

Oct 30th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. int main()
  4. {
  5.     char haupt_str[10][10] = {"       ", "       ", "        ", "       ","        ","      "};
  6.     char str[100];
  7.     int save_size[10];
  8.     printf("Enter your string \n");
  9.     gets_s(str, 100);
  10.     int len = strlen(str);
  11.     printf("%d", len);
  12.     int queue = 0;
  13.     int size = 0;
  14.     int j = 0;
  15.     for(int j = 0; j < len; j++)
  16.     {
  17.         if ((str[j] = !' ') || (str[j] = !'.') || (str[j] = !','))
  18.         {
  19.             haupt_str[queue][size] = str[j];
  20.             size++;
  21.         }
  22.         else
  23.         {
  24.             save_size[queue] = size;
  25.             size = 0;
  26.             queue++;//кількість елементів
  27.         }
  28.     }
  29.     printf("%d", queue);
  30.     for (int i = 0; i < queue; i++)
  31.     {
  32.         for (int j = 0; j < save_size[queue]; j++)
  33.         {
  34.             printf("%c", haupt_str[queue][save_size[queue]]);
  35.         }
  36.         printf("\n");
  37.     }
  38.     getchar();
  39.     getchar();
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement