Advertisement
Guest User

пътуване

a guest
Aug 27th, 2019
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. main () {
  7.  
  8.     string command;
  9.     double needed=0;
  10.     double saved=0;
  11.  
  12.     cin>>command;
  13.  
  14.     while (command!="End"){
  15.         cin>>needed;
  16.         double income=0;
  17.  
  18.         while(needed>saved){
  19.             cin>>income;
  20.             saved+=income;
  21.         }
  22.  
  23.     cout<<"Going to " << command<<"!" << endl;
  24.  
  25.     saved=0;
  26.     cin>>command;
  27. }
  28.  
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement