Advertisement
KlimexuS

Untitled

Jan 5th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define RozmiarTablicy 1000
  4.  
  5. struct struktura
  6. {
  7. int tab[RozmiarTablicy];
  8. int LiczbaElementow;
  9. int schowek[RozmiarTablicy];
  10. int LiczbaKopiowanych;
  11. }
  12. ;
  13.  
  14. void add(struct struktura* dodaj);
  15. void rew(struct struktura* odwroc);
  16. void sho(struct struktura* pokaz);
  17.  
  18.  
  19.  
  20. int main()
  21. {
  22. struct struktura lista;
  23. lista.LiczbaElementow = 0;
  24. lista.LiczbaKopiowanych = 0;
  25.  
  26. char akcja[4];
  27. scanf ("%3s", akcja);
  28. while(1)
  29. {
  30. if(strcmp(akcja, "ext")==0)
  31. break;
  32. else if(strcmp(akcja, "add")==0)
  33. add(&lista);
  34. else if(strcmp(akcja, "sho")==0)
  35. sho(&lista);
  36. }
  37.  
  38.  
  39.  
  40.  
  41. }
  42.  
  43. void add(struct struktura* dodaj)
  44. {
  45. scanf("%d", &(dodaj->tab[dodaj->LiczbaElementow]));
  46. dodaj->LiczbaElementow++;
  47. }
  48.  
  49. void rew(struct struktura* odwroc)
  50. {
  51. int a;
  52. int b;
  53. scanf("%d %d", a, b);
  54.  
  55. }
  56. void sho(struct struktura* pokaz)
  57. {
  58. int i=0;
  59. for(i=0; i<pokaz->LiczbaElementow; i++)
  60. {
  61. printf("%d, " ,pokaz->tab[i]);
  62. }
  63.  
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement