Professional Documents
Culture Documents
Array Lab
Array Lab
h>
int displayMenu();
float price();
void output();
float cost[10], sell[10], total = 0, profit = 0; int i=0;
void main(void)
{
int num;
printf("====================\n\tMENU\n====================\n\t1.Read
Information of buying cost and selling price\n\t2.Print output\n\t3.Exit\nEnter yor
choice<1-3>:");
scanf_s("%d", &num);
switch (num)
{
case 1:price(); break;
case 2: output(); break;
case 3:printf("\n=====BYE=====\n"); break;
default: displayMenu(); break;
}
float price(void)
{
}
return displayMenu();
}
void output()
{
for (i = 0; i < 10; ++i) {
profit = sell[i] - cost[i];
total += profit;
}
printf("Profit= %.2f\n", total);
displayMenu();
}
int displayMenu()
{
int num;
printf("====================\n\tMENU\n====================\n\t1.Read
Information of buying cost and selling price\n\t2.Print output\n\t3.Exit\nEnter yor
choice:");
scanf_s("%d", &num);
switch (num)
{
case 1: price(); break;
case 2: output(); break;
case 3:printf("\n=====BYE=====\n"); break;
default: displayMenu(); break;
}
return 0;
}