PROGRAM 8
// FILENAME: PROG8.CPP // THIS PROGRAM CALCULATES TOTAL YARDS AND PRICE OF CARPET AND PRINTS THEM // ON THE SCREEN. #include #include #include void main () { clrscr (); char my; int type, yards; float length, width, price; #include "a:\copy.h" gotoxy (6, 7); cout << " PROG8.CPP"; gotoxy (48, 14); my = getch (); window (1, 1, 80, 25); textbackground (3); clrscr (); gotoxy (18, 1); cout << "HONEST ABE'S CARPETORIUM"; gotoxy (17, 3); cout << "CARPET TYPES COST / YARD"; gotoxy (17, 5); cout << "1. QUALITY - $ 12.00"; gotoxy (17, 7); cout << "2. PREMIUM - $ 18.00"; gotoxy (17, 9); cout << "3. SUPERIOR - $ 22.00"; gotoxy (7, 11); cout << "CARPET TYPE DESIRED:"; gotoxy (7, 13); cout << " LENGTH DESIRED: WIDTH DESIRED:"; gotoxy (7, 15); cout << " YARDS NEEDED: PRICE:"; gotoxy (28, 11); cin >> type; gotoxy (28, 13); cin >> length; gotoxy (60,13); cin >> width; yards = ((length * width) / 9) + 1; if (type == 1) { price = 12.00 * yards; } if (type == 2) { price = 18.00 * yards; } if (type == 3) { price = 22.00 * yards; } gotoxy (28, 15); cout << yards; gotoxy (60, 15); cout.setf (ios :: showpoint); cout.setf (ios :: fixed); cout << setprecision (2) << price; gotoxy (7, 17); cout << "PRESS ENTER KEY TO QUIT. "; gotoxy (32, 17); my = getch (); return; } // FILENAME: COPY.H // SEE PROGRAM 7. // OUTFILE: PROG8.OUT HONEST ABE'S CARPETORIUM CARPET TYPES COST / YARD 1. QUALITY - $ 12.00 2. PREMIUM - $ 18.00 3. SUPERIOR - $ 22.00 CARPET TYPE DESIRED: 1 LENGTH DESIRED: 100 WIDTH DESIRED: 100 YARDS NEEDED: 1112 PRICE: 13344.00 PRESS ENTER KEY TO QUIT.
BACK TO CIS162 PAGE.