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.
#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;
}
Comments
Leave a comment