Answer to Question #285834 in C++ for Thurga

Question #285834

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


Brand: adidas


Model: Super-star


Price (RM): 450.99


Discount (%): 25.75


Seller: DEF Sdn Bhd


Postage: Lazada pos


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-09T13:06:18-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