Advertisement
kolioi

Traveling C++

Jul 15th, 2018
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4. int main()
  5. {
  6.     while (true)
  7.     {
  8.         string destination;
  9.         cin >> destination;
  10.         if (!destination.compare("End"))
  11.             break;
  12.  
  13.         double expences;
  14.         cin >> expences;
  15.  
  16.         double savings = 0, money;
  17.         while (savings < expences)
  18.         {
  19.             cin >> money;
  20.             savings += money;
  21.         }
  22.  
  23.         cout << "Going to " << destination << "!\n";
  24.     }
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement