[code]
//na
#include<iostream>
#include<string>
#include<cstdlib>
typedef char* IntArrayPtr;
const int size2 = 4;
int main()
{
using namespace std;
int row, col,size,size1, count = 0;
char y;
string x;
cout<< "Please enter the number of rows : \n";
cin>> size1;
IntArrayPtr *seat = new IntArrayPtr[size1];
for(int i=0 ; i< size1 ; i++)
{ seat[size1] = new char[size2];
}
for(row=0; row<size1; row++)
{ cout<< row+1<< " ";
for(col=0; col<size2; col++)
{
switch (col)
{case 0:
seat[row][col] = 'A';
break; case 1:
seat[row][col] = 'B';
break; case 2:
seat[row][col] = 'C';
break; case 3:
seat[row][col] = 'D';
break;}
cout<< seat[row][col]; }
cout<< endl; }
while(count<= size1*size2)
{
cout<< "Enter the seat "<<count+1<< endl;
do { cout<< "Enter the number of row: ";
cin>> row;
while(row < 1 || row > size1)
{ cout<<"Please Enter the number from 1 to 7:";
cin>> row; }
do { cout<< " choose the letter : ";
cin>> y;
switch (y)
{ case 'A': case 'a':
col = 0; break;
case 'B': case 'b':
col = 1; break;
case 'C': case 'c':
col = 2; break;
case 'D':case 'd':
col = 3; break;
default:
{ col = 4;
cout<< "sorry\n";
} }
}while(col == 4);
cout<<"Sorry"<< endl;
}while(seat[row-1][col] == 'X');
if(seat[row-1][col] != 'X')
{ seat[row-1][col] = 'X';
cout<< "this a seat on the plane " << endl; }
for(row=0; row<size1; row++)
{ cout<< row+1<< " ";
for(col=0; col<size2; col++)
{ cout<< seat[row][col];
}
cout<< endl;}
cout<< "Do you want running? Yes or no:\n";
cin>> x;
while(x != "Yes" || "yes")
{ if(x == "No" || "no")
{cout<< "Thank you\n";
exit(1);
}
else
{cout<< "Sorry try again\n";
}
cin>> x;
}
count++; }
cout<< "The seats of the plane \n";
for(int i=0; i<size1; i++)
delete[] seat;
delete []seat;
return 0;
}
انا عندي واجب حليته بس مأدري يوم اعمل كومبيلر ما يضبط
ممكن تشوفولي حل