Skip to content

Commit

Permalink
Update ex2_42_2.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 19, 2015
1 parent 0d6aa46 commit 9d5a3f4
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions ch02/ex2_42_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,22 @@

int main()
{
Sales_data book1, book2;
double price1, price2;
std::cin >> book1.bookNo >> book1.units_sold >> price1;
std::cin >> book2.bookNo >> book2.units_sold >> price2;
book1.CalcRevenue(price1);
book2.CalcRevenue(price2);
Sales_data book1, book2;
double price1, price2;
std::cin >> book1.bookNo >> book1.units_sold >> price1;
std::cin >> book2.bookNo >> book2.units_sold >> price2;
book1.CalcRevenue(price1);
book2.CalcRevenue(price2);

if (book1.bookNo == book2.bookNo)
{
book1.AddData(book2);
book1.Print();

return 0;
}
else
{
std::cerr << "Data must refer to same ISBN" << std::endl;
return -1; // indicate failure
}
if (book1.bookNo == book2.bookNo)
{
book1.AddData(book2);
book1.Print();
return 0;
}
else
{
std::cerr << "Data must refer to same ISBN" << std::endl;
return -1; // indicate failure
}
}

0 comments on commit 9d5a3f4

Please sign in to comment.