I'm working on a program that reads data from the user (in the form of number of people in a hotel room) and outputs whether or not there is a vacancy.

The code is as follows:


1) #include "stdafx.h"
2) #include <iostream>
3)
4) int main ()
5) {
6) using namespace std;
7) using namespace std;
8) cout << "How many people checked into room 1?" << endl;
9) int nPeople1;
10) cin>> nPeople1;
11) using namespace std;
12) cout << "How many people checked into room 2?" << endl;
13) int nPeople2;
14) cin>> nPeople2;
15) using namespace std;
16) cout << "How many people checked into room 3?" << endl;
17) int nPeople3;
18) cin>> nPeople3;
19) using namespace std;
20) cout << "How many people checked into room 4?" << endl;
21) int nPeople4;
22) cin>> nPeople4;
23) cout << "How many people checked into room 5?" << endl;
24) int nPeople5;
25) cin>> nPeople5;
26) if (nPeople1 == 0||nPeople2 == 0||nPeople3 == 0||nPeople4 == 0||nPeople5 == 0)
27) cout<< "VACANCY"<< endl;
28) else
29) cout<< "NO VACANCY"<< endl;
30)
31) return 0;
32) }

If possible, I would like to break the main function into 2 separate functions. One called IsOcc that gathers the data, and the main function to process and output the vacancy status.

Any help is greatly appreciated!

-Edide