Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <strings.h>
  3. #define MAX 30
  4. #define MAXM 12
  5. #define TAK 1
  6. #define NIE 0
  7.  
  8.  
  9. int czywolne();
  10. int pokazliczbe();
  11. int wysw_menu();
  12.  
  13.  
  14. struct rezer{
  15. int num;
  16. int flaga;
  17. char imie[MAX];
  18. char nazw[MAX];
  19. };
  20.  
  21.  
  22. int main(void)
  23. {
  24. int i;
  25. struct rezer wacja[12];
  26. struct rezer *wsk=&wacja;
  27. wacja[0].num=1;
  28. for(i=0; i<MAXM; i++){
  29. if(i!=0){
  30. wacja[i].num=wacja[i-1].num;
  31. wacja[i].num+=1;
  32. }
  33. else
  34. continue;
  35. }
  36. for(i=0; i<12; i++)
  37. printf("%d ", wacja[i].num);
  38. switch(wysw_menu())
  39. {
  40. case(1): pokazliczbe(wsk);
  41. break;
  42. //case(2):pokazpuste(wsk);
  43. // break;
  44. //case(3):pokazokna(wsk);
  45. //break;
  46. //case(4):rezerwacja(wsk);
  47. //break;
  48. case(5):printf("5");
  49. break;
  50. case(6):printf("6");
  51. break;
  52. default:printf("zleee");
  53. }
  54. return 0;
  55.  
  56.  
  57. }
  58.  
  59.  
  60. int wysw_menu()
  61. {
  62. int wybor;
  63. printf("Aby wybrac opcje, wpisz jej oznaczenie liczbowe:\n");
  64. printf("1. Pokaz liczbe pustych miejsc\n");
  65. printf("2: Pokaz liste pustych miejsc\n");
  66. printf("3: Pokaz puste miejsca przy oknach\n");
  67. printf("4: Zarezerwuj miejsce dla klienta\n");
  68. printf("5: Usun rezerwacje miejsca\n");
  69. printf("6: Koniec\n");
  70. scanf("%d", &wybor);
  71. return wybor;
  72. }
  73.  
  74. int czywolne(wsk)
  75. {
  76. int i=0;
  77. for(i=0; i<12; i++)
  78. {
  79. if(wsk->flaga==0)
  80. return 0;
  81. else return 1;
  82. }
  83. }
  84.  
  85. int pokazliczbe(wsk)
  86. {
  87. int i=0;
  88. int licznik=0;
  89. for (i=0;i<12; i++)
  90. {
  91. if(czywolne(wsk)==1)
  92. licznik++;
  93. else return 0;
  94.  
  95.  
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement