Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. // Test 2 ex 7
  2. #include <iostream>
  3. #include <string>
  4.  
  5. using namespace std;
  6.  
  7. int arrive(int a){
  8.     a++;
  9.     return a;
  10. }
  11.  
  12. int depart(int d){
  13.     d++;
  14.     return d;
  15. }
  16. int main(){
  17.     int input = 0;
  18.    
  19.     int dep = 0;
  20.     int arr = 0;
  21.     while(input != -1){
  22.         cout << "Press 1 when airplane arrives" << endl;
  23.         cout << "Press 2 when airplane departs" << endl;
  24.         cout << "Press -1 to stop the execution." << endl;
  25.         cin >> input;
  26.         if(input == 1){
  27.             arr = arrive(arr);
  28.         } else if(input == 2){
  29.             dep = depart(dep);
  30.         }
  31.        
  32.     }
  33.    
  34.     cout << "Total number of landed airplanes " << arr << endl;
  35.     cout << "Total number of departed airplanes " << dep << endl;
  36.    
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement