/* Martin Hess, 9.05.2001 MC1 TSU */ #include #include #include void crt_init(void); // Initialisiert Screem float get_price(void); // Eingabe Preis int get_piece(void); // Eingabe St…kzahl float calc_rabatt(float tot_price); // Berechnet Rabatt int calc_add(int x); // Berechnet R《tzuschlag float calc_small(float price); // Berechnet Versandkostenanteil void output(int count, float price); // Ausgabe /* Globale Variablen */ void main(void) { /* lokale Variablen */ float price; int count; int rabatt; /* Beginn main */ crt_init(); price = get_price(); count = get_piece(); price = count * price; // Totalbetrag price = calc_rabatt(price); price = price + calc_add(count); price = calc_small(price); output(count,price); } // of main void crt_init(void) { clrscr(); gotoxy(25,1); printf("***** 喘ung 8 Martin Hess *****"); gotoxy(25,2); printf("***** Preisberechnung *****"); } // of crt_init float get_price(void) { float pps; printf("\n\n Preis pro St…k : "); scanf("%f",&pps); return(pps); } // of get_price int get_piece(void) { int count; printf(" Anzahl St…k : "); scanf("%d",&count); return count; } // of get_piece float calc_rabatt(float tot_price) { float new_pr; new_pr = tot_price; if (tot_price > 100.0) new_pr = tot_price * 0.97; if (tot_price > 250.0) new_pr = tot_price * 0.95; return(new_pr); } // of calc_rabatt int calc_add(int x) { int additional = 0; if (x <= 10 ) additional = 10; if (x = 1 ) additional = 25; return(additional); } // of calc_add float calc_small(float price) { float new_pr; new_pr = price; if (price < 200.0) new_pr += 7.5; return(new_pr); } // of calc_small void output(int count, float total) { char nothing [2]; printf("\n\n\n** Ausgabe **"); printf("\n\n St…kzahl : %d",count); printf("\n Totalpreis : %8.2f",total); printf("\n\n** Berechnung beendet. Bitte Emter dr…ken **"); gets(nothing); gets(nothing); } // of output