Advertisement
markkoval1999

Untitled

Oct 30th, 2016
99
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.  
  9.     printf("Enter your string \n");
  10.     gets_s(str, 100);
  11.     int len = strlen(str);
  12.     printf("%d", len);
  13.     int queue = 0;
  14.     int size = 0;
  15.     int j = 0;
  16.     for(int j = 0; j < len; j++)
  17.     {
  18.         if ((str[j] != ' ') || (str[j] != '.') || (str[j] != ','))
  19.         {
  20.             haupt_str[queue][size] = str[j];
  21.             size++;
  22.         }
  23.         else
  24.         {
  25.             save_size[queue] = size;
  26.             size = 0;
  27.             queue++;//кількість елементів
  28.         }
  29.     }
  30.     printf("%d",queue);
  31.     for (int i = 0; i < queue; i++)
  32.     {
  33.         for (int j = 0; j < save_size[queue]; j++)
  34.         {
  35.             printf("%c", haupt_str[queue][save_size[queue]]);
  36.         }
  37.         printf("\n");
  38.     }
  39.     getchar();
  40.     getchar();
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement