Advertisement
markkoval1999

Untitled

Oct 31st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.70 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.     int queue = 0;
  12.     int size = 0;
  13.    
  14.     for (int j = 0; j < len; j++)
  15.     {
  16.         if ((str[j] != ' ') || (str[j] !='.') || (str[j] != ','))
  17.         {
  18.             haupt_str[queue][size] = str[j];
  19.             size++;
  20.         }
  21.         else
  22.         {
  23.             save_size[queue] = size;
  24.             size = 0;
  25.             queue++;//кількість елементів
  26.         }
  27.     }
  28.  
  29.     for (int i = 0; i < queue; i++)
  30.     {
  31.         for(int j = 0; j < save_size[queue]; j++)
  32.         {
  33.             printf("%c", haupt_str[queue][save_size[queue]]);
  34.         }
  35.         printf("\n");
  36.     }
  37.     getchar();
  38.     getchar();
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement