Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include "func.h"
  5. void addToList(thelist* shoppingList);
  6.  
  7.  
  8.  
  9. //-------------------------------MAIIN------------------------------------------------
  10.  
  11.  
  12. int main()
  13. {
  14. int option; //Variable for choosing in the menu
  15. thelist shoppingList; //initiation of the struct shoppingList
  16. initThelist(&shoppingList);
  17.  
  18. while(1)
  19. {
  20. printf("Welcome to your the list handler.\n 1 - add a food item\n 2 - print the shoppinglist\n 3 - Remove an item\n 4 - Change the amount \n What would you like to do?\n");
  21.  
  22.  
  23.  
  24. if(shoppingList.listLength==0)
  25. {
  26. printf("List is empty\n");
  27. }
  28. else
  29. {
  30. printf("List is not empty\n");
  31. }
  32.  
  33. scanf("%d", &option);
  34.  
  35.  
  36. switch(option){
  37. {
  38. case 1:
  39. {
  40. addToList( &shoppingList);
  41. break;
  42. }
  43. case 2:
  44. {
  45. printList( &shoppingList);
  46. break;
  47. }
  48. case 3:
  49. {
  50. delItem( &shoppingList);
  51. break;
  52. }
  53.  
  54. }
  55.  
  56. }
  57.  
  58. return 0;
  59. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement