printf("\n\nPACKAGE A,B,C,D (X = EXIT) : "); scanf("%c", &ch); getchar();
1. Please someone help me ,how can i make the remove fisrt line (photot as below ) after the program run.
#include <stdio.h> #include <stdlib.h> #include<string.h> #pragma warning(disable:4996) int main(void) { //Package category array while (choice != 'n' && choice != 'N') { //Continue taking the package and quantity input till X while (ch != 'X') { if (ch == 'A') { scanf("%d", &qtyA); getchar(); if (ch == 'B') { scanf("%d", &qtyB); getchar(); } if (ch == 'C') { printf("\nQuantity : "); scanf("%d", &qtyC); getchar(); quantity[2] += qtyC; } if (ch == 'D') { scanf("%d", &qtyD); getchar(); quantity[3] += qtyD; } } //Print the details of package and add to total if (qtyA != 0) { printf("\nPACKAGE A : %d @ RM 24.50 = RM %.2f", qtyA, qtyA * price[0]); total += qtyA * price[0]; } if (qtyB != 0) { total += qtyB * price[1]; } if (qtyC != 0) { printf("\nPACKAGE C : %d @ RM 27.50 = RM %.2f", qtyC, qtyC * price[2]); total += qtyC * price[2]; } if (qtyD != 0) { printf("\nPACKAGE D : %d @ RM 29.00 = RM %.2f", qtyD, qtyD * price[3]); total += qtyD * price[3]; } printf("\n=======================================================================\n"); //Check the total value of purchase and update the delivery and discount if (total > 80) { printf("\nPACKAGE CHARGES : RM %.2f", total); if (total > 100) { delivery = 0.0; printf("\nDelivery fees : RM%.2f", delivery); discount = 0.15 * total; printf("\nDiscount : RM%.2f", discount); } //Calculate the net amount to be paid by Customer net = total + delivery - discount; } else { printf("\nPACKAGE CHARGES : RM %f", total); delivery = 5.0; printf("\nDelivery fees : RM%.2f", delivery); discount = 0.0 * total; printf("\nDiscount : RM%.2f", discount); net = total + delivery - discount; } //print the total amount printf("\nTotal to pay : RM %.2f", net); ch = 'A'; qtyA = 0; qtyB = 0; qtyC = 0; printf("\n\nTHANK YOU, HAVE A NICE DAY!"); qtyD = 0; total = 0.0; //Ask if next Customer is available printf("\n\nNext Customer ? (Y/N) : "); scanf("%c", &choice); } //Print the daily sales report |
Step by step
Solved in 3 steps with 2 images