0

I can't find whats the error here. Pls help to have a look on this ^^

#include <stdio.h>
#include <conio.h>
#define tax 0.05


struct jitemenu{
char menitem[10];
double harga[10];
}menu[100];

void items(int ,int,double,double); // pengistiharan function
void tunjukmenu();
void resit(int, double, double, double);

int main()
{
int Q[10], item,i,c;
tunjukmenu();


void items(int item,int Q[10],double harga ,double total);

while ( item != 9 || item <=8)
{
printf("Please enter a Item No. : ");
scanf("%d", &item);

if (item != 9 || item <=8)
{
printf("Berapa unit? : ");
scanf("%d", &Q[item]);
++i;
}
}

for(c=0;c<i;c++)
{
void resit(int item, double total, double totax, double jumlah);
}

}
void tunjukmenu()
{

printf("Selamat datang ke Hifi's Restaurant\n");
printf("**************************************\n");
printf("1. Plain Egg $2.50\n");
printf("2. Bacon and Egg $3.45\n");
printf("3. Muffin $2.20\n");
printf("4. French Toast $2.95\n");
printf("5. Fruit Basket $3.45\n");
printf("6. Cereal $0.70\n");
printf("7. Coffee $1.50\n");
printf("8. Tea $1.80\n");
printf("9. Selesai dan print resit\n ");
}
void resit(int item, double total, double totax, double jumlah)
{
int Q[item];
totax=total*tax;

jumlah= totax+total;
printf("Welcome to HiFi's Restaurant\n");
printf("%d %s $%lf",Q[item],menu.menuitem[item],(float)Q[item]*menu.harga[item]);
printf("Tax 5\% %2.2lf",totax);
printf("Amount Due %2.2lf ",jumlah);

printf("jumlah keseluruhan %0.2lf",jumlah);
}

void items(int item,int Q[10], double harga,double total)
{

switch(item)
{
case 1:harga+=2.50*Q[item];menu.menitem[item]="Plain Egg";menu.harga[item]=2.50;
case 2:harga+=3.45*Q[item];menu.menitem[item]="Bacon and Egg";menu.harga[item]=3.45;
case 3:harga+=2.20*Q[item];menu.menitem[item]="Muffin";menu.harga[item]=2.20;
case 4:harga+=2.95*Q[item];menu.menitem[item]="French Toast";menu.harga[item]=2.95;
case 5:harga+=3.45*Q[item];menu.menitem[item]="Fruit Basket";menu.harga[item]=3.45;
case 6:harga+=0.70*Q[item];menu.menitem[item]="Cereal";menu.harga[item]=0.70;
case 7:harga+=1.50*Q[item];menu.menitem[item]="coffee";menu.harga[item]=1.50;
case 8:harga+=1.80*Q[item];menu.menitem[item]="Tea";menu.harga[item]=1.80;
case 9:total+=harga;
default:printf("input tidak sah!masukkan item yang tersenarai pada menu sahaja===>");

}
}
2
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by fazdhli
0

ok thanks ^^ i still noob on this..hope can finish my assignment. But at the same time i very2 poor on this subject. TQ

0

You still need to know what the errors are. One obvious one is line 21, where did that come from? Also, check what your array Q holds and see what information you are asking it for.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.