Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int clients;
- cin >> clients;
- cin.ignore();
- string stock;
- double totalSum = 0;
- for (int i = 0; i < clients; i++) {
- getline(cin, stock);
- int counter = 0;
- double sum = 0;
- while (stock != "Finish") {
- if (stock == "basket") {
- sum += 1.50;
- }
- else if (stock == "wreath") {
- sum += 3.80;
- }
- else if (stock == "chocolate bunny") {
- sum += 7.00;
- }
- getline(cin, stock);
- counter++;
- }
- if (counter % 2 == 0) {
- sum *= 0.80;
- }
- totalSum += sum;
- printf("You purchased %i items for %.2f leva.\n", counter, sum);
- }
- printf("Average bill per client is: %.2f leva.\n", totalSum / clients);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement