Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- double neededSum, currentSum, income = 0;
- cin >> neededSum;
- cin.ignore();
- string cocktailName;
- getline(cin, cocktailName);
- int cocktailCount;
- while (cocktailName != "Party!" && income < neededSum) {
- cin >> cocktailCount;
- cin.ignore();
- currentSum = cocktailCount * cocktailName.length();
- if ((int)currentSum % 2 == 1) {
- currentSum *= 0.75;
- }
- income += currentSum;
- getline(cin, cocktailName);
- }
- if (neededSum > income) {
- printf("We need %.2f leva more.\n", neededSum - income);
- }
- else {
- cout << "Target acquired.\n";
- }
- printf("Club income - %.2f leva.\n", income);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement