Void Struct Int Int Int Struct Char Int Int Int Struct Struct Int
Void Struct Int Int Int Struct Char Int Int Int Struct Struct Int
h>
void main()
{
struct date
{
int day;
int month;
int year;
};
struct details
{
char name[20];
int price;
int code;
int qty;
struct date mfg;
};
struct details item[50];
int n, i;
printf("Enter number of items:");
scanf("%d", &n);
fflush(stdin);
for (i = 0; i < n; i++)
{
fflush(stdin);
printf("Item name: \n");
scanf("%s", item[i].name);
fflush(stdin);
printf("Item code: \n");
scanf("%d", &item[i].code);
fflush(stdin);
printf("Quantity: \n");
scanf("%d", &item[i].qty);
fflush(stdin);
printf("price: \n");
scanf("%d", &item[i].price);
fflush(stdin);
printf("Manufacturing date(dd-mm-yyyy): \n");
scanf("%d-%d-%d", &item[i].mfg.day,
&item[i].mfg.month, &item[i].mfg.year);
}
printf(" ***** INVENTORY ***** \n");
printf("---------------------------------------------------------
---------\n");
printf("S.N.| NAME | CODE | QUANTITY | PRICE
| MFG.DATE \n");
printf("---------------------------------------------------------
---------\n");
for (i = 0; i < n; i++)
printf("%d %-15s %-d %-5d %-5d
%d/%d/%d \n", i + 1, item[i].name, item[i].code, item[i].qty,
item[i].price, item[i].mfg.day, item[i].mfg.month,
item[i].mfg.year);
printf("---------------------------------------------------------
---------\n");
}
#include <ctype.h>
#include <windows.h>
void lunch();
void dinner();
void m_m();
void exit();
float price;
float total;
char choice;
int again;
void main()
m_m();
{
char choice = ' ' ; //local variable
printf(" && Please select the meal that you would like to purchase. && \n\n");
scanf("%c", &choice);
system("cls");
if (toupper(choice) == 'A' )
bfast();
else
if (toupper(choice) == 'B')
lunch();
else
if (toupper(choice) == 'C')
dinner();
else
if (toupper(choice) == 'D')
exit();
else
m_m();
}
int quantity = 0;
int again = 0;
fflush(stdin);
printf(" && Please select the food that you would like to purchase. && \n\n");
scanf("%d", &choice);
if (choice == 1)
scanf("%d", &quantity);
printf("\nWould you like to buy anything else?\n[1] Yes , [2] No : "); // Allows user to choose
whether to check-out or buy anything else.
scanf("%d", &again);
system("cls");
if (again == 1 )
bfast();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if ( choice == 2)
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n\n\n ", total);
printf("\nWould you like to buy anything else?\n[1] Yes , [2] No : "); // Allows user to
choose whether to check-out or buy anything else.
scanf("%d", &again);
system("cls");
if (again == 1 )
bfast();
else if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if ( choice == 3 )
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n\n\n ", total);
printf("\nWould you like to buy anything else?\n[1] Yes , [2] No : "); // Allows user to
choose whether to check-out or buy anything else.
scanf("%d", &again);
system("cls");
if (again == 1 )
bfast();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if (choice != 1 , 2 , 3 )
fflush(stdin);
system("cls");
bfast();
int quantity;
int again;
printf(" Welcome to D'10 Restaurant. \n ");
printf(" && Please select the food that you would like to purchase. && \n\n");
scanf("%d", &choice);
if (choice == 1)
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n\n\n ", total);
scanf("%d", &again);
system("cls");
if (again == 1 )
lunch();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
{
printf("\n\n\t\tSorry Invalid Decision Entered\n\n\n\n");
exit();
else
if ( choice == 2)
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n\n\n ", total);
scanf("%d", &again);
system("cls");
if (again == 1 )
lunch();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
}
else
if ( choice == 3 )
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n\n\n ", total);
scanf("%d", &again);
system("cls");
if (again == 1 )
lunch();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if (choice != 1 , 2 , 3)
fflush(stdin);
system("cls");
lunch();
int quantity;
int again;
printf(" && Please select the food that you would like to purchase. && \n\n");
scanf("%d", &choice);
if (choice == 1)
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n ", total);
scanf("%d", &again);
system("cls");
if (again == 1 )
dinner();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if ( choice == 2)
scanf("%d", &quantity);
printf("Your total amount is RM%.2f , Please pay at the counter\n ", total);
scanf("%d", &again);
system("cls");
if (again == 1 )
dinner();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if ( choice == 3 )
scanf("%d", &quantity);
scanf("%d", &again);
system("cls");
if (again == 1 )
dinner();
else
if (again == 2 )
m_m();
else
if (again != 1 , 2)
exit();
else
if (choice != 1 , 2 , 3)
fflush(stdin);
system("cls");
dinner();
}
}