Advertisement
Guest User

GWSH Lista 1

a guest
Oct 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. struct Timie
  6. {
  7.     char im[30];
  8.     struct Timie *nast;
  9.  
  10.  
  11. };
  12. int main()
  13. {
  14.     struct Timie *pocz, *wsk1, *wsk2;
  15.     char imie[30];
  16.  
  17.     pocz = NULL;
  18.        
  19.     puts("podaj imie:");
  20.    
  21.     gets_s(imie, 30);
  22.     while (imie[0] != '\0') // jeśli wpisaana wartośc rozna od pustej
  23.     {
  24.         wsk1 = malloc(sizeof(struct Timie));
  25.         strcpy_s(wsk1->im, 30 ,imie); // secure dodaje ilośc znaków
  26.         wsk1->nast = pocz;
  27.         pocz = wsk1;
  28.         puts("podaj imie:");
  29.         gets_s(imie, 30);
  30.  
  31.     }
  32.     // wyswietlanie
  33.  
  34.     while (wsk1 != NULL)
  35.     {
  36.         puts(wsk1->im);
  37.         wsk1 = wsk1->nast;
  38.         system("PAUSE");
  39.     }
  40.  
  41.  
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement