Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- string destination;
- double budget, moneyOnHand, currentSum;
- while (true) {
- cin >> destination;
- if (destination == "End") {
- break;
- }
- cin >> budget >> moneyOnHand;
- while (budget > moneyOnHand) {
- cin >> currentSum;
- moneyOnHand += currentSum;
- }
- cout << "Going to " << destination << "!\n";
- }
- return 0;
- }
- Или леко тарикатската:)
- #include <iostream>
- using namespace std;
- int main() {
- string destination;
- cin >> destination;
- double budget, currentSum;
- while (destination != "End") {
- cin >> budget;
- while (budget > 0) {
- cin >> currentSum;
- budget -= currentSum;
- }
- cout << "Going to " << destination << "!\n";
- cin >> destination;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement