Skip to content

Commit

Permalink
Update ex1_22.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Jun 18, 2015
1 parent 72844ac commit 8ec06df
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions ch01/ex1_22.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@

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

return 0;
return 0;
}

0 comments on commit 8ec06df

Please sign in to comment.