10 or more phones order
Alexey Feldgendler
alexey at feldgendler.ru
Mon Apr 28 10:38:59 CEST 2008
On Mon, 28 Apr 2008 10:20:46 +0200, ian douglas
<ian.douglas at iandouglas.com> wrote:
>> Well, may be that i missed the answer but someone asked if the
>> discount and the extra stuff are applied only to the 10 pack or it
>> could also be a 12 pack?
>> So to let you understand the condition is:
>> if (phones_ordered == 10)
>> do_the_10_pack_trick();
> More like:
>
> if (phones_ordered && phones_ordered % 10 == 0)
> do_the_10_pack_trick();
I just can't leave it like that. :-)
if (phones_ordered % 10 * PRICE_1 > PRICE_10_PACK)
phones_ordered += 10 - phones_ordered % 10;
for (; phones_ordered >= 10; phones_ordered -= 10)
do_the_10_pack_trick();
for (; phones_ordered >= 1; phones_ordered--)
no_tricks_just_order_1();
--
Alexey Feldgendler <alexey at feldgendler.ru>
[ICQ: 115226275] http://feldgendler.livejournal.com
More information about the community
mailing list