p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C++ Programming (http://p2p.wrox.com/forumdisplay.php?f=89)
-   -   AIRPLANE SEAT CHART..... PLEASE HELP (http://p2p.wrox.com/showthread.php?t=3539)

Raineri33 September 5th, 2003 03:36 PM

I am new to c++, and i have a program to do as follows:
 1) fill a 2D array for the seat chart with * ... DONE
 2) add a passenger to the plane
     I am stuck here, i have the info put into the cin statements etc, but how do i make it so that it makes an 'X' in the seat that they want to sit in ?????
 3) sort the list of passengers added
     I have written a selection sort as follow: (can anyone tell me why it will not compile with code?
//prototype: void print_list(pass_rec passlist[size] ,int );
//function call: print_list(passlist,count);
void print_list(pass_rec passlist,int count)
    int min_loc=0;
    pass_rec temp;
    for(int pass=1; pass < count; pass++)
        min_loc = pass-1;
        for(int i = pass; i < count; i++)
            if(passlist[min_loc] > passlist[i])
                min_loc = i;
        if(min_loc != pass-1)
            temp.lname = passlist[min_loc].lname;
            passlist[min_loc] = passlist[pass-1];
            passlist[pass-1] = temp;
        cout << passlist[min_loc] << endl;


Ibn_Aziz September 7th, 2003 08:49 AM

I have tried my best to understand your question... but I am having difficulty..... and I suspect this is why.. no one has replied yet.........!!

Please elaborate..... " seat chart " ????

Raineri33 September 8th, 2003 10:54 PM

I got help from fellow students, but thanks ya'll I will def be posting more if I need more help

nikolai September 8th, 2003 11:11 PM

Bear in mind that none of us are here to do your homework for you. I understand that this is a useful QnA forum, but in my opinion, you don't learn as effectively as you would by working out the problems yourself or going over them with a teacher or tutor.

When a student is first learning how to program, regardless of language, getting the questions answered isn't nearly as important as learning how to solve the problems. Once you have worked hard (and it can be difficult!) to develop strong analytical and problem-solving skills, you can apply those skills to problems in a multitude of languages.

The goal, therefore, is not to teach you how to program in C++, but rather, how to solve problems using C++ as the language in which you express your solutions.

I hope I'm making sense!

When I tutored fellow students in C, C++, and Java, the best pieces of advice I gave them were:

1) Think about the problem and answer in English (or whatever your native language is). Try and come up with a reasonable answer that you could tell someone. This answer doesn't have to be as details as line-by-line pseudocode.

2) Draw everything out. Diagram your memory, both stack and heap. The stack is where function parameters and local variables are created. The heap is where dynamically allocated memory is taken. Write down a list of all your important variables and keep track of their values as you trace through your program. Do this on a whiteboard or with pencil and paper. I call this "manual debugging". Most people would suggest using an actual debugger application to step through their code, but I think doing it by hand forces you to look much more closely at your own program logic and discover flaws and subtle bugs that would ordinarily stump you for a while. This is especially true when writing loops or recursive functions.

That said, if you're STILL having problems, ask for general help relating to your problem, but don't ask about your problem.

Take care,


nikolai September 8th, 2003 11:18 PM

One more note -- many (most? all?) schools require that students sign an "integrity agreement", basically a contract stating that the student will not copy work from anyone else. These contracts also explicitly limit getting specific problem help from outside sources such as this forum or chatrooms.

You'll find that most good programmers are good at what they do because they put in the time and effort to learn how to do things the "right way", that is, without a lot of outside help, and that they are not very willing to help other students breeze through their homework.

Don't get me wrong -- I'm not calling you a cheater or anything, I don't know your situation.

Regardless, it's not cool or kosher to post homework problems in support forums or chat rooms and expect other people to do your work for you. After all, suppose you finish all your Computer Science classes having had lots of help from others with your assignments. You'll likely get a programming job, which means two things: You'll be competing for those jobs with other students who did all their own work and, therefore, deserve the job more, and 2) be working with other programmers who did their own work and won't want to tolerate a programmer who can't figure their problems out for themselves.

I know I sound like an ****************************, a repetitive one at that, but trust me -- you're much better off taking the time and suffering with your difficult assignments now, because the skills you gain from it will be much more of a help to you down the road than any of us answering your toy problems now can be.

Take care,


All times are GMT -4. The time now is 04:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.