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