Answer to Question #285542 in C++ for thurga

Question #285542

You are required to create a programming to display the pricing, discounted value, who is the seller and postage company. 

Please include the necessary library before typing your codes. 

Item: shoe, smartphone, Tv, Table fan

Brand: adidas, apple, Samsung, Media

Model: Super-star, 12, S50LED, M17T

Price (RM): 450.99, 4569.99, 1999.99, 555.55

Discount (%): 25.75, 10.75, 20.25, 15.25

Seller: DEF Sdn Bhd, Enjit2 Semut Enterprise, Ah Huat sdn bhd, Jalin enterprise

Postage: Lazada pos, GRAB, City Link, Postlaju.

The output from the codes must have the command COUT for every item. 

Construct the necessary script to solve the given problem. 

 


1
Expert's answer
2022-01-07T15:59:03-0500
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int d;
    cout << "Enter the number of denominations: ";
    cin >> d;
    int denoms[d];
    for (int i = 0; i < d; ++i) {
        int denom;
        cout << "Enter your denominations: ";
        cin >> denom;
        denoms[i] = denom;
    }
    sort(denoms, denoms + d, greater<int>());
    int amount;
    cout << "Enter your amount: ";
    cin >> amount;

    for (int i = 0; i < d; i++) {
        int total = 0;
        cout << "# " << denoms[i] << " cents ---- " << (amount / denoms[i]) << endl;
        amount = amount % denoms[i];
    }
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment