why only the succeeding value adds up???
hi guys i wonder what i am messing in my program,
Code:
main()
{
clrscr();
int order;
char ans;
int total;
printf("Good Day Ma'am/Sir !!!\n\n");
printf("\t1. Regular Yum \t\t\t\t\tP25.00\n");
printf("\t2. One Piece Chicken Joy\t\t\tP55.00\n");
printf("\t3. One Piece Burger Steak \t\t\tP45.00\n");
printf("\t4. Spaghetti\t\t\t\t\tP35.00\n");
printf("\t5. Regular Yum with Spaghetti\t\t\tP50.00\n");
printf("\t6. One Piece Burger Steak with Spaghetti\tP70.00\n");
printf("\t7. One Piece Chicken Joy with Spaghetti\t\tP80.00\n");
printf("\t8. Softdrinks\t\t\t\t\tP15.00\n\n\n");
do
{
printf("\nPlease select your order: ");
scanf("%d",&order);
total=0;
if(order==1){
total=25.00;
}
else if (order==2){
total=55.00;
}
else if(order==3){
total=45.00;
}
else if (order==4){
total=35.00;
}
else if(order==5){
total=50.00;
}
else if (order==6){
total=70.00;
}
else if(order==7){
total=80.00;
}
else if(order==8){
total=15.00;
}
total+=total;
printf("\nWould you like to order again?(y/n) ");
scanf(" %c",&ans);
}
while(ans=='y');
printf("\nYour total order is P%d.",total);
getch();
return(0);
}
when my program displays the total, only the second orders adds up or the succeeding order adds up?
am i messing something???