#include <iostream>
using namespace std;

void intialize(char array[][6]){
	for(int i=0;i<13;i++)
		for(int j=0;j<6;j++)
			array[i][j]='*';
}

void menu (char array [][6]){
	cout <<endl;

	cout<<"\tA\tB\tC\tD\tE\tF"<<endl;
	for (int i =0; i<13 ;i++){
		cout<<"Row "<<i+1<<'\t';
		for(int j=0;j<6;j++){
			cout<<array[i][j]<<"\t";
		}
		cout<<endl;
	}
	cout<<endl;
}

void main(){

	char array[13][6];
	intialize(array);
	char smoking,type,exit,column;
	int row,col;

	do{
		smoking = 'N';
		do{
			cout<<"Enter ticket type (F:first class or E:economy class) : ";
			cin >> type;
		}while(type !='F' &&type !='f'&&type !='e'&&type !='E');

		if(type =='E' || type=='e'){
			cout <<"Enter \'S\' for smoking section or \'N\' nonsmoking section : ";
			cin>> smoking;
		}

		menu(array);

		//do{
			cout <<"Enter desired seat ( Row and Column ) : ";
			cin >>row >> column;
			while (row <=0 && row>13 || column < 'A' && column < 'F'){
				cout<<"Invalid value "<<endl;
				cout <<"Enter desired seat ( Row and Column ) : ";
				cin >>row >> column;
			}

			while ((type =='F' || type=='f') && row >2){
				cout <<"Error! ,only first and second rows is first economy class"<<endl;
				cout <<"Enter desired seat ( Row and Column ) : ";
				cin >>row >> column;
			}

			while ((smoking=='S' || smoking=='s') && row <8 ){
				cout <<"Error! ,this section is nonsmoking"<<endl;
				cout <<"Enter desired seat ( Row and Column ) : ";
				cin >>row >> column;
			}

			do{

			switch (column){
			case 'A':
				col = 0;
				break;
			case 'B':
				col = 1;
				break;
			case 'C':
				col = 2;
				break;
			case 'D':
				col = 3;
				break;
			case 'E':
				col = 4;
				break;
			case 'F':
				col = 5;
				break;
			}
			if (array[row-1][col]=='X'){
				cout<<"The seat is occupied "<<endl;
				cout <<"Enter desired seat ( Row and Column ) : ";
				cin >>row >> column;
			}
			else
				break;
			}while(true);
			
			cout<<"Your seat is in Row "<<row<<" and in column "<<column<<endl;
			array[row-1][col]='X';
			
			menu(array);

		cout<<"Enter E to Exit or enter any key to continue : ";
		cin >>exit;
		
	}while(exit !='E' && exit !='e');

}

how can I make the last code shorter and more clear .

>how can I make the last code shorter and more clear .
I'd say it's plenty clear, and the only easy way to make it shorter is to drop the switch statement in favor of something like this:

// Find the display index of the selected column
col = column - 'A';

To nitpickers: yes, I know.

This article has been dead for over six months. Start a new discussion instead.