hi, can you help me with my code? actually its running but the total price of products bought is not displaying, can you help me with this one? :(
#include<stdio.h>
#include<string.h>
#include<conio.h>
int main(void)
{
int pno, choice, product, jf=12,d=10,l=107,c=2,cf=22,n=9,b=19,ap,a,total,disc,i,ctr,nSelection;
char name[50]; char cname[50]; char y; char x;
float price,qty,tax,dis,bill,dprice,ttotal;
printf("\n\tMINI SUPER MARKET BILLING SYSTEM");
printf("\tMADE BY : NICKSON GIL\n");
printf("\t \t \t \t \tEnjoy :)");
printf("\n \n \n \t<1> Credit Card <2> Cash");
printf("\n \n \t \tPlease Choose the type of Payment : ");
scanf("%d", &choice);
switch(choice){
case 1:
printf("\n \tCredit Card Payment");
break;
case 2:
printf("\n \tCash Payment");
break;
default:
{
printf("The Program will be terminated");
return 0;
}
}
{
y:
printf("\n \tCHOOSE A PRODUCT: ");
printf("\n<1> Junk Food <2> Diapers <3> Liquors <4> Condiments\n<5> Can Foods <6> Noodles <7> Beverages :");
scanf("%d", &product);
switch(product){
case 1:
printf("\n \tHow Many? : ");
scanf("\n \t%d", &a);
i=a*jf;
printf("\n \tPrice: %d", i);
break;
case 2:
printf("\n \tHow Many? : ");
scanf("\n \t%d", &a);
i=d*a;
printf("\n \tPrice: %d", i);
break;
case 3:
printf("\n \tHow Many? : ");
scanf("\n \t%d", &a);
i=l*a;
printf("\n \tPrice: %d", i);
break;
case 4:
printf("\n \tHow Many? : ");
scanf("%\n \td", &a);
i=c*a;
printf("\n \tPrice: %d", i);
break;
case 5:
printf("\n \tHow Many? : ");
scanf("\n \t%d", &a);
i=cf*a;
printf("\n \tPrice: %d", i);
break;
case 6:
printf("\n \tHow Many? : ");
scanf("\n \t%d", &a);
i=n*a;
printf("\n \tPrice: %d", i);
break;
case 7:
printf("\n \tHow Many? : ");
scanf("%d", &a);
i=b*a;
printf("\n \tPrice: %d", i);
break;
default:
{
printf("The Program will be terminated");
return 0;
}
}
printf("\n \tAnother Product? <1> Yes <2> No :");
scanf("%d", &ap);
if(ap==1)
goto y;
else if(ap==2)
goto n;
else if(ap>2)
{
printf("The Program will be terminated");
return 0;
}
else if(ap=0)
{
printf("The Program will be terminated");
return 0;
}
n:
printf("\tPlease Enter the Discount (%%) :");
scanf("%f", &dis);
disc=dis/100;
printf("\n\tDiscount :%.2f%%",dis);
printf("\n\tTotal: %d", i);
dprice=ttotal/dis;
printf("\n\tDiscount Exemption: %.2f", dprice);
bill=ttotal-dprice;
printf("Total Bill: %.2f", bill);
}
getch();
}