Skip to content

Commit

Permalink
这里没有考虑未超出部分打折情况
Browse files Browse the repository at this point in the history
如题
  • Loading branch information
cheng668 authored Aug 4, 2016
1 parent 53e1dfe commit ed1e268
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch15/ex15.7/limit_quote.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Limit_quote : public Quote
Quote(b,p), max_qty(max), discount(disc) { }

double net_price(std::size_t n) const override
{ return n * price * (n < max_qty ? 1 - discount : 1 ); }
{ return n * price - discount * price * ( max_qty > n ? n : max_qty ); }

private:
std::size_t max_qty = 0;
Expand Down

0 comments on commit ed1e268

Please sign in to comment.