Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- //while
- //повтаряме: въвеждат държави
- //стоп: destination == "End"
- //продължаваме: destination != "End"
- string destination; //държава или "End"
- cin >> destination;
- while (destination != "End")
- {
- //държава за посещение -> destination
- double needBudget; //нужна сума за посещението
- cin >> needBudget;
- //спестяване
- double savedSum = 0; //общо спестени пари
- //повтарям: въвеждам суми, които спестявам
- //стоп: savedSum >= needBudget
- //продължавам: savedSum < needBudget
- while (savedSum < needBudget)
- {
- double money; //колко пари е спестила за един ден
- cin >> money;
- savedSum += money;
- }
- //savedSum >= needBudget -> отивам на дестинацията
- cout << "Going to " << destination << "!" << endl;
- cin >> destination;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement