Help Do This! Thanks :))

A small airline has just purchased a computer for its new automated reservation system. you have been asked to program a new system. Develop a program to assign seats on each flight of the airline's only plane (capacity = 10 seats)

your program should display the following alternatives

Please type 1 for "SMOKING"

Please type 2 for "Non-Smoking"

if the person types 1, your program should assign a seat in the smoking section (seats 1-5). If a person types 2, your program should assign a seats in the non-smoking section (seats 6-10). your program should then print a boarding pass indicating the person's seat number and whether it is in the smoking or non-smoking section of the plane.

Use a single-subscripted array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seats is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available.

Your program should never assign a seat that has already been assigned. When the smoking section is full, your program should ask a person if it is acceptable to be placed in the non-smoking area section ( and vice versa ), If yes, make the appropriate a seat assignment. If no, print the message " Next flight leaves in 3 hours! ".

Needed:
1. I haven't done this part: "Your program should never assign a seat that has already been assigned. When the smoking section is full, your program should ask a person if it is acceptable to be placed in the non-smoking area section ( and vice versa ), If yes, make the appropriate a seat assignment. If no, print the message " Next flight leaves in 3 hours! ".

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
  #include<iostream>
using namespace std;

int main()
{
	char choice;
	cout << "Please type 1 for SMOKING SECTION"<<endl;
	cout << "Please type 2 for NON-SMOKING SECTION" << endl;
	cout << "Section: ";
	cin>>choice;
	system ("cls");
	
	if (choice == '1')
	{
	int airplaneseat [1][5];
	char seats [1][5];
	int row[2];
	char seatplan;
	
	for (int r = 0; r < 1; r++)
	{
        for (int c = 0; c < 5; c++)
        {
            seats [r][c] = '0';
            airplaneseat [r][c] = 0;
        }
    }
    for (;;)
    {
    cout << "\t\t\Welcome to the Pacific Airlines" << endl;
    cout << "Smoking Section" << endl;
    cout << endl;
    
    cout<<" \tA\tB\tC\tD\tE"<<endl; // display the whole seats
    cout<<"1\t"<<seats[0][0]<<"\t"<<seats[0][1]<<"\t"<<seats[0][2]<<"\t"<<seats[0][3]<<"\t"<<seats[0][4]<<endl;
    cout<<endl;
    
    cout<<"Choose your desired seat(Example: 1A): ";// asks the users to input desired seat
    cin>>row[0];
    cin>>seatplan;
    
    switch (seatplan)
    {
    case 'A':
    case 'a':
    row[0] = row[0] - 1;
    row[1] = 1;
    row[1] = row[1] - 1;
    break;

    case 'B':
    case 'b':
    row[0] = row[0] - 1;
    row[1] = 2;
    row[1] = row[1] - 1;
    break;

    case 'C':
    case 'c':
    row[0] = row[0] - 1;
    row[1] = 3;
    row[1] = row[1] - 1;
    break;
  
    case 'D':
    case 'd':
    row[0] = row[0] - 1;
    row[1] = 4;
    row[1] = row[1] - 1;
    break;
    
    case 'E':
    case 'e':
    row[0] = row[0] - 1;
    row[1] = 5;
    row[1] = row[1] - 1;
    break;
	}
	{
if(row[0]+1 == 1)
{

if(airplaneseat[row[0]][row[1]] == 0)
{
airplaneseat[row[0]][row[1]] = 1;
seats[row[0]][row[1]] = '1';
cout << endl;
cout << "Your Boarding Pass!" << endl;
cout << "Section: Smoking Section" <<  endl;
cout << "Seat Number: Row 1" << seatplan << endl;
system ("pause");
}
else if(airplaneseat[row[0]][row[1]] == 1)
{
cout<<"The seat that you have entered "<<row[0] + 1<<seatplan<<" is already occupied.\nPlease another seat."<<endl;
system("Pause");

}

}
else
{
cout<<"Invalid input"<<endl;
system("Pause");
system("cls");

}

}
row[0] = 0;
row[1] = 0;
system("cls");
}	
return main(); 

	}
if (choice == '2')
	{

	int airplaneseat [1][5];
	char seats [1][5];
	int row[2];
	char seatplan;
	
	for (int r = 0; r < 1; r++)
	{
        for (int c = 0; c < 5; c++)
        {
            seats [r][c] = '0';
            airplaneseat [r][c] = 0;
        }
    }
    for (;;)
    {
    cout << "\t\t\Welcome to the Pacific Airlines" << endl;
    cout << "Non-Smoking Section" << endl;
    cout << endl;
    
    cout<<" \tF\tG\tH\tI\tJ"<<endl; // display the whole seats
    cout<<"1\t"<<seats[0][0]<<"\t"<<seats[0][1]<<"\t"<<seats[0][2]<<"\t"<<seats[0][3]<<"\t"<<seats[0][4]<<endl;
    cout<<endl;
    
    cout<<"Choose your desired seat(Example: 1A): ";// asks the users to input desired seat
    cin>>row[0];
    cin>>seatplan;
    
    switch (seatplan)
    {
    case 'F':
    case 'f':
    row[0] = row[0] - 1;
    row[1] = 1;
    row[1] = row[1] - 1;
    break;

    case 'G':
    case 'g':
    row[0] = row[0] - 1;
    row[1] = 2;
    row[1] = row[1] - 1;
    break;

    case 'H':
    case 'h':
    row[0] = row[0] - 1;
    row[1] = 3;
    row[1] = row[1] - 1;
    break;
  
    case 'I':
    case 'i':
    row[0] = row[0] - 1;
    row[1] = 4;
    row[1] = row[1] - 1;
    break;
    
    case 'J':
    case 'j':
    row[0] = row[0] - 1;
    row[1] = 5;
    row[1] = row[1] - 1;
    break;
	}
	{
if(row[0]+1 == 1)
{

if(airplaneseat[row[0]][row[1]] == 0)
{
airplaneseat[row[0]][row[1]] = 1;
seats[row[0]][row[1]] = '1';
cout << endl;
cout << "Your Boarding Pass!" << endl;
cout << "Section: Non-Smoking Section" <<  endl;
cout << "Seat Number: Row 1" << seatplan << endl;
system ("pause");

}
else if(airplaneseat[row[0]][row[1]] == 1)
{
cout<<"The seat that you have entered "<<row[0] + 1<<seatplan<<" is already occupied.\nPlease another seat."<<endl;
system("Pause");
}

}
else
{
cout<<"Invalid input"<<endl;
system("Pause");
system("cls");
	
}

}
row[0] = 0;
row[1] = 0;
system("cls");

}	
return main(); 

	}


	system("pause");
	return 0;


}

what the hell are those return main()'s doing??
oh yes, i forgot to erase that. thank you for seeing that.
now have you tried my code ? have you solve the problem??
just store the seats booked in a vector. then when you come to book another seat check that seat isn't in the vector.
can you show me the codes and where do i need to put that? because i really find it hard to do that. i've been doing this since last week and i'm stock in that problem. thanks you for helping me here.
Topic archived. No new replies allowed.