Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Test 2 ex 7
- #include <iostream>
- #include <string>
- using namespace std;
- int arrive(int a){
- a++;
- return a;
- }
- int depart(int d){
- d++;
- return d;
- }
- int main(){
- int input = 0;
- int dep = 0;
- int arr = 0;
- while(input != -1){
- cout << "Press 1 when airplane arrives" << endl;
- cout << "Press 2 when airplane departs" << endl;
- cout << "Press -1 to stop the execution." << endl;
- cin >> input;
- if(input == 1){
- arr = arrive(arr);
- } else if(input == 2){
- dep = depart(dep);
- }
- }
- cout << "Total number of landed airplanes " << arr << endl;
- cout << "Total number of departed airplanes " << dep << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement