I need help with the two dimentiona array because this is a big program to start learning this. Here's what i have so far.

#include <iostream>
#include <cstdlib>
#include <cstddef>
//typedef char* CharArrayPtr;
//CharArrayPtr a;
//a = new char[number_of_rows];
int NO_ROWS = 7;
typedef char* SeatRow[4];
typedef SeatRow Seating[NO_ROWS];
//Seating seatAssignment;
int main()
{
using std::cout;
using std::cin;
using std::endl;
Seating plan;
int row;
char seat;
int seatNo;
int r;
int s;

cout << "Enter Number of rows";
cin >> NO_ROWS;
//Initialize seating to empty
for(r = 0; r < NO_ROWS; r++)
for (s = 0; s < 4; s++)
*plan[r][s] = char ('A' + s);
cout << "Savitch Airlines\n"
<< "Seat Reservation Program.\n"
<< "Reserved seats are marked 'X'. Others are available.\n";
// Display seats
for(r = 1; r < NO_ROWS; r++)
{
for (s = 0; s < 4; s++)
{
cout << plan[r][s] << " ";
if(s == 1 )
cout << " ";
}
cout << endl;
}
char ans = 'a';
while(ans != 'n' && ans != 'N')
{
cout << "America Airlines\n"
<< "Seat Reservation Program.\n"
<< "Reserved seats are marked 'X'. Others are available.\n";
cout << "Please enter your requst in the form \"3C\" for Row 3, SeatC\n"
<< "There are " << NO_ROWS << " rows. Seats are A, B, C, D.\n";
cin >> row >> seat;
seatNo = seat - 'A';
if('X' != *plan[row][seatNo])
{
*plan[row][seatNo] = 'X';
}
else
{
cout << "****That seat is taken****.\n****No assignment made****.\n"
<< "****Please make another request****\n";
}
//Display current seating
for(r = 1; r < NO_ROWS; r++)
{
for (s = 0; s < 4; s++)
{
cout << plan[r][s] << " ";
if(s == 1 )
cout << " ";
}
cout << endl;
}
cout << "N or n quits, anyting else continues\n";
cin >> ans;
}
return 0;
}

Please state clearly what problem you are trying to solve and what are the difficulties you are facing. Don't expect us to read through your code and find out the problem.

Sorry i paniced, it was due last night. But i was trying to add a dynamic array to this reservation program. But trying to alter code was hard.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.