C++ help

Hi . I need help. It's a simple plane seat booking system.
Let's say this are the available seats :
1 A B C D
2 A B C D
3 A B C D

And the user entered row and seats
Let's say he enters row 2 seat C

How do I change the output display too for X is already booked
1 A B C D
2 A B X D
3 A B C D

closed account (Dy7SLyTq)
put it into a 2d array and have them enter a coordinate and if they enter a valid column/row you change the corresponding number in the array to x
How do i make a 2D array with both char and int inside? :o is it possible? Can you show me an example ?
closed account (Dy7SLyTq)
you dont need to.

char array[4][3] = {"AAABBBCCCDDD"};

int xcoor, ycoor;

cin>> xcoor >> ycoor;

array[xcoor][ycoor] = 'x';


its not the best written thing but it will suffice for my example.
Oo. I'm stucked here goes my program so far :

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
int main()
{	const int x=7, y=4;
	char seats[x][y] = {{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'},{'A','B','C','D'}};
	int row;
	char seat;
		
	cout<<"Unavailable seats are marked [X]."<<endl;
	for ( int i=0; i<x; i++) // This loop is for rows.
	{
		cout<<i+1<<" ";		
		for (int j=0; j<y; j++) // This is for column
		{
			cout<<seats[i][j]<<" ";
		}
		cout<<endl;
		cout<<endl;
	}

	cout<<"Enter a row :";
	cin>>row;
	cout<<"Enter a seat :";
	cin>>seat;

	seats[row][seat] = 'X';

	return 0;
}


I'm stucked at seats. Not sure how to manipulate after i enter a row and seat .
Topic archived. No new replies allowed.