The lowest price of the book of Software Engineering introduction

Source: Internet
Author: User

Train of thought: only 8 This number special, 3+5>4+4, other as long as except 5 take surplus can.

I stole a lazy, directly listed if ...

#include <iostream>using namespacestd;voidMain () {intN; inti; cout<<"Please enter this number:"<<Endl; CIN>>N; I= n/5; if(n<5)    {        if(n==1) cout<<"Lowest Price is $8"<<Endl; if(n==2) cout<<"Lowest Price is"<<n*8*0.95<<"Yuan"<<Endl; if(n==3) cout<<"Lowest Price is"<<n*8*0.9<<"Yuan"<<Endl; if(n==4) cout<<"Lowest Price is"<<n*8*0.8<<"Yuan"<<Endl; }    Else    {        if(n%5==0) {cout<<i<<"set of 5 copies of the"<<Endl; cout<<"the lowest price is:"<<i*8*5*0.75<<Endl; }        if(n%5==1) {cout<<i<<"set of 5 copies"<<Endl; cout<<"Plus"<<n%5<<"this"<<Endl; cout<<"the lowest price is:"<<i*8*5*0.75+ (n%5)*8<<Endl; }        if(n%5==2) {cout<<i<<"set of 5 copies"<<Endl; cout<<"Plus"<<n%5<<"this"<<Endl; cout<<"the lowest price is:"<<i*8*5*0.75+ (n%5)*8*0.95<<Endl; }        if(n%5==3) {cout<<i-1<<"set of 5 copies of the"<<Endl; cout<<"plus 2 sets of 4 copies"<<Endl; cout<<"the lowest price is:"<< (I-1)*8*5*0.75+2*4*8*0.8<<Endl; }        if(n%5==4) {cout<<i<<"set of 5 copies"<<Endl; cout<<"Plus"<<n%5<<"this"<<Endl; cout<<"the lowest price is:"<<i*8*5*0.75+ (n%5)*8*0.8<<Endl; }    }}

The lowest price of the book of Software Engineering introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.