Seat selection c++ stuck

Hi, I urgently need help.
My code compiles but i having lots of problem in it.
1)Whenever i key in my seat like A1, the loops doesn't work. It works only if i key in numbers.
2)How do i prevent double seat selections(it means whenever somebody choosing that seats, nobody can choose it again)

3)cout << "A:_1_::_2_::_3_:: ::_4_::_5_::_6_::"<<endl;
cin >> seat;

output shows
A:_1_::_2_::_3_:: ::_4_::_5_::_6_::"A1

The user key in A1, and the screen return another output shows
A:_X_::_2_::_3_:: ::_4_::_5_::_6_::"


How to do that? Can somebody guide me or shows me??

Sorry for my poor English. I appreciate any helps. Thanks first.




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
#include <iostream>
#include <cstdlib>


using namespace std;

int main()
{
    char chs4;
    static int seats=0;
    int passenger;
    char seat[2];

                cout << "Passenger Number:";
                cin  >> passenger;
                cout << "Would You Like To Select Your Seat? (y/n):";
                cin  >> chs4;

                if(chs4 == 'Y' || chs4 == 'y')
        {
            while(seats<passenger)
            {
                cout << "  --------------------------------"<<endl;
                cout << "  \t~C O C K P I T~\t\t"<<endl;
                cout << "  --------------------------------"<<endl;
                cout << "A:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "B:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "C:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "D:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "E:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "F:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << " :                                :"<<endl;
                cout << "G:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "H:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "I:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "J:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "K:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "L:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "M:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;
                cout << "N:_1_::_2_::_3_::  ::_4_::_5_::_6_:"<<endl;

                cout << "Enter Your Seat Choice:";
                cin >> seat;
                cout <<endl;

                seats++;
            }
                system("pause");
                return 0;

      }
}


Topic archived. No new replies allowed.