Thursday, 15 October 2015

Restaurant Bill project on C

#include<stdio.h>

#include<string.h>

main(){

char order[20];

float totalBill=0;

int price;

printf("**Menu:**\n**\tA=Rice = P15.00\t**\n**\tB=Friedchicken = P35.00**\n**\tC=Porkchop = P65.00\t**\n**\tD=Fishtinola =P15.00\t**\n**\tD=Porkmenudo =P45.00\t**\n**\tF=Chopsuey =P25.00\t**\n***** Q=Quit/Done ****\n\n");

while(!(strcmp(order,"Q"))==0 || strcmp(order,"q")==0){

printf("\n***Please select if what's your order:***\n");

scanf("%s",order);

if(strcmp(order,"A")==0 || strcmp(order,"a")==0){

totalBill=totalBill+15;

}

else if (strcmp(order,"B")==0 || strcmp(order,"b")==0){

totalBill=totalBill+35;

}

else if (strcmp(order,"C")==0 || strcmp(order,"c")==0){

totalBill=totalBill+65;

}

else if (strcmp(order,"D")==0 || strcmp(order,"d")==0){

totalBill=totalBill+15;

}

else if (strcmp(order,"E")==0 || strcmp(order,"e")==0){

totalBill=totalBill+45;

}

else if (strcmp(order,"F")==0 || strcmp(order,"f")==0){

totalBill=totalBill+25;

}

}

printf("\nYour total bill is P%.2f\n\n",totalBill);

}


No comments:

Post a Comment