Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- void orderSum(string product, int quantity) {
- double productPrice =
- product == "coffee" ? 1.50 :
- product == "water" ? 1.00 :
- product == "coke" ? 1.40 :
- product == "snacks" ? 2.00 : 0;
- cout << fixed << setprecision(2) << productPrice * quantity << endl;
- }
- int main() {
- string product;
- cin >> product;
- int quantity;
- cin >> quantity;
- orderSum(product, quantity);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement