void chooseseat(char seats[][MAX_SEAT]) {int row,col; bool goodseat=false; char
ID: 3618029 • Letter: V
Question
void chooseseat(char seats[][MAX_SEAT])
{int row,col;
bool goodseat=false;
char seatcol;
do{
cout<<"Enter Seat row desired1-"<<MAX_ROW<<": ";
cin>>row;
while(row>MAX_ROW||row<1)
{cout<<"invalidrow ";
cout<<"Enter Seat row desired1-"<<MAX_ROW<<": ";
cin>>row;
}
row--;
cout<<"Enter Seat desiredA-"<<(char)('A'-1+MAX_SEAT)<<":";
cin>>seatcol;
seatcol=toupper(seatcol);
col=seatcol-'A';
while(col>=MAX_SEAT||col<0)
{cout<<col<<endl;
cout<<"invalidseat ";
cout<<"Enter Seat desiredA-"<<(char)('A'-1+MAX_SEAT)<<":";
cin>>seatcol;
seatcol=toupper(seatcol);
col=seatcol-'A';
}
if(seats[row][col]!='X')
goodseat=true;
else
goodseat=false;
if(!goodseat)
cout<<"Seat alreadychosen-rechoose ";
}while (!goodseat);
seats[row][col]='X';
return;
}
Explanation / Answer
please rate - thanks neater, and without the bool, and with a few comments void chooseseat(char seats[][MAX_SEAT]) {int row,col; char seatcol; do{ coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.