I am working on a seat reservation program and here are some of its parts. My objective is to mark 'X' on the array using the user input. This is based on a tic tac toe program but I need to mark X only in the table. I am asking if I am doing the loop for the program correctly and if not what I use to fix it. I am facing errors but I don't know if this is the right loop for them.
I want to mark X based on the input of rows and columns that they are given and if it is already entered or marked. I want to say that it is already taken and will prompt the user again if they want to enter a new input again and if not they will be returned to the main menu again.
typedef struct{
char city[20], name[50], seatcol;
int age, seatrow, id;
}passenger;
char seat[ROWS][COLS];
void reserve(){
passenger p;
do {
printf("\n\t\t\tEnter your seat number:");
printf("\n\t\t\tROW:(1-10) ");
scanf(" %d",&p.seatrow);
printf("\t\t\tCOLUMN:(A-F) ");
scanf(" %s ", p.seatcol);
if(p.seatrow == 1 && p.seatcol == 'A')(
seat[0][0]= 'X');
else if(p.seatrow == 1 && p.seatcol == 'B')(
seat[0][1]= 'X');
else if(p.seatrow == 1 && p.seatcol == 'C')(
seat[0][2]= 'X');
else if(p.seatrow == 1 && p.seatcol == 'D')(
seat[0][3]= 'X');
else if(p.seatrow == 1 && p.seatcol == 'E')(
seat[0][4]= 'X');
else if(p.seatrow == 1 && p.seatcol == 'F')(
seat[0][5]= 'X');
//2
else if(p.seatrow == 2 && p.seatcol == 'A')(
seat[1][0]= 'X');
else if(p.seatrow== 2 && p.seatcol == 'B')(
seat[1][1]= 'X');
else if(p.seatrow == 2 && p.seatcol == 'C')(
seat[1][2]= 'X');
else if(p.seatrow == 2 && p.seatcol == 'D')(
seat[1][3]= 'X');
else if(p.seatrow == 2 && p.seatcol == 'E')(
seat[1][4]= 'X');
else if(p.seatrow == 2 && p.seatcol == 'F')(
seat[1][5]= 'X');
else{
printf("Invalid option!");
p.id--;
getch();
}
p.id++;
status = (p.seatrow && p.seatcol != seat);
}while(status);
if(!status){
printf("\n\t\t Already allocate seat. Choose another seat? (Y/N)");
scanf("%s", answer);
if(answer == ' Y'){
printf("\n\t\t\tROW:(1-10) ");
scanf(" %d",&p.seatrow);
printf("\t\t\tCOLUMN:(A-F) ");
scanf(" %s ", p.seatcol);
}
else{
printf("Your data will be not saved and will be returned to main menu:");
mainmenu();
}
}
}