Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #include<stdio.h>
  2. //int *ptr_food;
  3. //int *ptr_beer;
  4.  
  5. struct data {
  6. int food;
  7. int beer;
  8. int mineral;
  9. int coins;
  10. };
  11.  
  12.  
  13.  
  14. struct data1 {
  15. int boredom;
  16. int lassitude;
  17. int *ptr_food;
  18. int *ptr_beer;
  19.  
  20. } inventory_situation_of_dwarf;
  21.  
  22.  
  23.  
  24. int main()
  25. {
  26. int pom=0;
  27.  
  28. struct data main_storage;
  29. struct data1 inventory_situation_of_dwarf;
  30.  
  31. main_storage.food = 14;
  32. main_storage.beer = 12;
  33. main_storage.mineral = 10;
  34. main_storage.coins = 20;
  35.  
  36. inventory_situation_of_dwarf.boredom = 0;
  37. inventory_situation_of_dwarf.lassitude = 1;
  38. inventory_situation_of_dwarf.ptr_food = main_storage.food;
  39. inventory_situation_of_dwarf.ptr_beer = main_storage.beer;
  40.  
  41. printf("zadajte volbu skladu pre vypis informacii:\n");
  42. printf("pre volbu dwarf skladu stlac = 1\n");
  43. printf("pre volbu inventaru a dwarfa stlac = 0\n");
  44. scanf("%d",&pom);
  45.  
  46. switch(pom){
  47. case 1:
  48. printf("food: %d\n",main_storage.food);
  49. printf("beer: %d\n",main_storage.beer);
  50. printf("mineral: %d\n",main_storage.mineral);
  51. printf("coins: %d\n",main_storage.coins);
  52. break;
  53. case 0:
  54. printf("boredom: %d\n",inventory_situation_of_dwarf.boredom);
  55. printf("lassitude: %d\n",inventory_situation_of_dwarf.lassitude);
  56. printf("actuall food: %d\n",inventory_situation_of_dwarf.ptr_food);
  57. printf("actuall beer: %d\n",inventory_situation_of_dwarf.ptr_beer);
  58. break;
  59. }
  60.  
  61.  
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement