Q:

Using the Sales_item.h header from the Web site, compile and execute the bookstore program presented in this section

0

Using the Sales_item.h header from the Web site, compile and execute the bookstore program presented in this section.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <iostream>
#include "Sales_item.h"

int main() {
  Sales_item total;
  if (std::cin >> total) {
    Sales_item trans;
    while (std::cin >> trans) {
      if (total.isbn() == trans.isbn())
        total += trans;
      else {
        std::cout << total << std::endl;
        total = trans;
      }
    }
    std::cout << total << std::endl;
  } else {
    std::cerr << "No data!" << std::endl;
    return -1;
  }
  return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now