void main() { printf(" IT Magey \n"); int code; printf("\nEnter item code : T"); scanf("%d", &code); double price; printf("Enter item price : "); scanf("%lf", &price); double dct; printf("Enter discount ('%%') : "); scanf("%lf", &dct ); char m; printf("Enter payment mode (F or I): "); scanf("%c \n", &m); switch ('m') { case 'F': case 'f': printf("\n"); printf("Payment Details \n"); printf("-----------------------------\n"); printf("Item Code : T003256\n"); printf("Item price: USD 2342.80\n"); double dct1=price*dct/100; printf( "Discount: USD%lf \n", dct1); double amount1=price-dct1; printf("Amount to pay: USD%lf", amount1 ); break; case 'I': case 'i': printf("\n"); int mth; printf("Enter number of installments (months) : "); scanf("%d", &mth); printf("\n"); printf("Payment Details \n"); printf("-----------------------------\n"); printf("Item Code : T003256\n"); printf("Item price: USD 2342.80\n"); double dct2=price*dct/100; printf( "Discount: USD%lf \n", dct2); double amount2=price-dct1; printf("Amount to pay: USD%lf", amount2 ); printf("\n"); printf("Number of installments : %d \n", mth); double amount3=price/mth; printf(" Amount to pay per installement : USD%lf", amount3 ); break; default: printf("Please select only F or I"); }
Newbie here, my switch statement won't show any output besides the default one. I've added (breaks) to it still the same nevertheless. If there are other issues regarding this program besides the switch statement, do list them out too. Thanks :)
Just started using this site, I'm trying to fill in more details to satisfy the error of having too less details :/
https://stackoverflow.com/questions/67352576/c-language-switch-statement May 02, 2021 at 10:52AM
没有评论:
发表评论