Expand|Select|Wrap|Line Numbers
- showItem(book[choice-1]); //displays the array address user choses less one
- break;
- case 0:
- cout << "Here are all the books available :" << endl;
- for (int i=0; i < 8; i++) //my array loop, c++ array elements begin at zero!
- {
- showItem(book[i]); //displays memory allocation book[i] 0-7
- }
- break;
- case 90:
- if (lastChosenBook == -1) {
- cout << "Choose a book first!" << endl;
- } else {
- int n;//THERE'S A FLAW IN MY CODE HERE, A CHAR CREATES AN INFINITE LOOP, AN INTEGER DOES NOT???
- cout << "Enter the number of books and then hit 'Enter': ";
- cin >> n;
- while(book[lastChosenBook-1].buy(n)==-1) {
- cout << "There are only " << book[lastChosenBook-1].getAmount() << "books available" <<endl;
- }
- cout << "You order is accepted; Transmit $" << fixed << setprecision(2) << book[lastChosenBook-1].getPrice()*1.085 << " to our bank account XXX-XXXXX-XXXX" << endl;
- }
- break;
- case 99:
- exit = true; //boolean condition met
- break;
- default:
- cout << "Incorrect value entered; please follow directions explicitly," <<'\n'; ;
- cout << "this is not a crystal ball!!!!!" << endl;
- cout<< "Now hit 'Enter' and try again!" << endl;
- }
- }
- while (!exit);