fork download
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3.  
  4. /* Supporting Structures */
  5. struct date {
  6. int month;
  7. int day;
  8. int year;
  9. };
  10.  
  11. struct volume {
  12. float amount; // e.g., 12.0
  13. char unit[10]; // e.g., "oz", "ml", "L"
  14. };
  15.  
  16. struct manufacturer {
  17. char name[100]; // e.g., "Anheuser-Busch"
  18. char city[50]; // e.g., "St. Louis"
  19. char state[50]; // e.g., "MO"
  20. };
  21.  
  22. struct abv {
  23. float percentage; // e.g., 5.0 for 5% alcohol by volume
  24. };
  25.  
  26. /* Base Structure: Beer */
  27. struct Beer {
  28. int stockID; // Unique identifier
  29. struct date bornOnDate; // Brewing date
  30. char name[100]; // e.g., Bud Light
  31. char type[50]; // e.g., "American Light Lager"
  32. struct volume containerSize; // e.g., 12 oz
  33. struct abv alcoholContent; // Alcohol % by volume
  34. struct manufacturer brewery; // Brewery details
  35. bool isDomestic; // Domestic or imported
  36. };
  37.  
  38. /* Base Structure: Wine */
  39. struct Wine {
  40. int stockID;
  41. char name[100]; // e.g., Earthquake
  42. char varietal[50]; // e.g., Cabernet Sauvignon
  43. char style[50]; // e.g., "Red"
  44. struct manufacturer winery; // e.g., Michael David Winery
  45. struct volume bottleSize; // e.g., 750ml
  46. struct abv alcoholContent;
  47. int vintage; // e.g., 2020
  48. bool isSparkling; // Sparkling wine or not
  49. };
  50.  
  51. /* Base Structure: Spirits */
  52. struct Spirits {
  53. int stockID;
  54. char name[100]; // e.g., Jack Daniel's
  55. char type[50]; // e.g., "Whiskey"
  56. struct manufacturer distillery;
  57. struct volume bottleSize;
  58. struct abv alcoholContent;
  59. int age; // Years aged, if applicable
  60. bool isFlavored; // e.g., Vanilla, Honey, etc.
  61. };
  62.  
  63. int main() {
  64. // Placeholder main function just to ensure compilation.
  65. printf("Structures for Beer, Wine, and Spirits defined successfully.\n");
  66. return 0;
  67. }
  68.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
Structures for Beer, Wine, and Spirits defined successfully.