Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int neededSteps = 10000;
- string input;
- while (neededSteps > 0) {
- getline(cin, input);
- if (input == "Going home") {
- getline(cin, input);
- neededSteps -= stoi(input);
- break;
- }
- neededSteps -= stoi(input);
- }
- if (neededSteps <= 0) {
- cout << "Goal reached! Good job!\n";
- }
- else {
- cout << neededSteps << " more steps to reach goal.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement