-1

can someone help me ? i have problem to make airplane seating program.. what it need is i ust put the details of the booker in the seat.. for example , when we want to check who already booked this seat,we click that seat and it will appear name and i/c number of the booker..then , and the booker also can canceling their seat.. that unavailable seat become available again.. can someone help me ?

Edited by deceptikon: Violation of homework rule

5
Contributors
9
Replies
30
Views
4 Years
Discussion Span
Last Post by deceptikon
0

I'm not good about this.. thats was my final project that my lecturer gave me.. I'm really2 noob about programming.. thats why i need someone help me..

0

Daniweb is not designed for us to write your code for you, especially not course work.

We shall happily help with specific questions, or point you in the correct direction if you need help debugging etc. but you MUST show that you have done some prior work.

Think through your problem logically, write down the steps you need to take (an algorithm) and then begin. If you get stuck on a specific area then come back and ask another question.

-1
#include <iostream>
using namespace std;

const int NUMROWS = 7;
const int NUMSEATS = 4;

void initPlane(char plane[NUMROWS][NUMSEATS]);
// POSTCONDITION:
// plane[x][0] == 'A', 0<=x<=6
// plane[x][1] == 'B', 0<=x<=6
// plane[x][2] == 'C', 0<=x<=6
// plane[x][3] == 'D', 0<=x<=6

void printPlane(char msg[], char plane[NUMROWS][NUMSEATS]);
// POSTCONDITION: The seating layout of the plane has been printed
// to the standard output with an X displayed for each taken seat.

void getSeat(char &row, char &seat);
// POSTCONDITION: 1 <= row <= 7, 'A' <= seat <= 'D'
// Note that getSeat does not check to see if the seat has been taken.

int main()
{
int seatsTaken = 0;
int seats = NUMROWS * NUMSEATS;
char plane[NUMROWS][NUMSEATS];
char keepGoing = 'y';
char row, seat;
int rowIndex, seatIndex;

initPlane(plane);

cout << "Choose your seat!" << endl;
while (seatsTaken < seats && keepGoing == 'y')
{
//
// Show layout and get seat choice
//
printPlane("Plane layout; X designates taken seats", plane);
cout << "Enter the row(1-7) and seat(A-D) you would like (e.g., 3D): ";
getSeat(row, seat);

//
// Adjust input to use as indices
//
rowIndex = row - '1';
seatIndex = seat - 'A';

//
// Check to see if seat is taken
//
if (plane[rowIndex][seatIndex] == 'X')
cout << "Sorry, " << row << seat << " is already taken." << endl;
else
{
cout << "OK, you've got " << row << seat << endl;
plane[rowIndex][seatIndex] = 'X';
seatsTaken++;
}

//
// If there are seats left, see if we should keep going
//

if (seatsTaken < seats)
{
cout << "Choose another seat? (y/n) ";
cin >> keepGoing;
}
else
cout << "Plane is now full!" << endl;
}

printPlane("Final seating chart", plane);
}

void initPlane(char plane[NUMROWS][NUMSEATS])
{
int x,y;
plane[0][0] = ' ';
for (x = 1; x < NUMROWS; x++)
{
plane[0][x] = 'A' + (x - 1);
}
for (x = 1; x < NUMROWS; x++)
{
for ( y = 0 ; y < 13 ; y++)
plane[x][y] = ' ';
}
for (x = 1; x < NUMROWS ; x++)
{
for ( y = 1 ; y < NUMSEATS ; y++)
plane[x][y] = '*';
}
}

void printPlane(char msg[], char plane[NUMROWS][NUMSEATS])
{

}

void getSeat(char &row, char &seat);
{

}
Votes + Comments
Complete fail at cheating and lying
0

Ok, so now you have some of the code completed, what is the error and what where you expecting to happen?

Edited by Octet: Fixing Grammar

0

i want that passenger will enter their name and i/c number and save that data.. when we click that seat it will appear that data..

0

Seeing as how you just copied and pasted that code from any number of places around the internet, why don't you just get the answer from the same places, the complete working code is also available.

Edited by Suzie999

0

its ok u cant help.

It's not a matter of "can't". We won't help when you're looking for a handout. The sad part is that not only did you steal the posted code to trick people into believing you did any work (which you clearly did not), you stole it from Daniweb, which makes it doubly easy for us to find and expose your lies.

Please read our rules, this thread is closed as a violation of the homework rule.