Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- int food;
- cin >> food;
- food *= 1000;
- string command;
- cin >> command;
- while (command != "Adopted") {
- food -= stoi(command);
- cin >> command;
- }
- if (food >= 0){
- cout << "Food is enough! Leftovers: " << food << " grams.\n";
- }
- else{
- cout << "Food is not enough. You need " << abs(food) << " grams more.\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement