Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 5th, 2003, 03:36 PM
Registered User
 
Join Date: Sep 2003
Location: Myrtle Beach, SC, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default AIRPLANE SEAT CHART..... PLEASE HELP

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;
    }
    system("pause");
}

PLEASE ANYONE HELP
Reply With Quote
  #2 (permalink)  
Old September 7th, 2003, 08:49 AM
Authorized User
 
Join Date: Sep 2003
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 " ????
Reply With Quote
  #3 (permalink)  
Old September 8th, 2003, 10:54 PM
Registered User
 
Join Date: Sep 2003
Location: Myrtle Beach, SC, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got help from fellow students, but thanks ya'll I will def be posting more if I need more help
Reply With Quote
  #4 (permalink)  
Old September 8th, 2003, 11:11 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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,

Nik
http://www.bigaction.org/
Reply With Quote
  #5 (permalink)  
Old September 8th, 2003, 11:18 PM
Friend of Wrox
Points: 2,570, Level: 21
Points: 2,570, Level: 21 Points: 2,570, Level: 21 Points: 2,570, Level: 21
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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,

Nik
http://www.bigaction.org/
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chart keso VB How-To 2 November 30th, 2006 04:51 AM
Help on Pie Chart DudeBori82 Classic ASP Professional 9 May 3rd, 2005 04:24 PM
Chart and XML macromotion Flash (all versions) 0 December 11th, 2004 12:42 PM
Using Customized chart for Pivot Chart kliu9 Excel VBA 3 October 13th, 2004 09:37 AM
Drill Down from Bar Chart to another chart snowbird Crystal Reports 0 July 11th, 2003 01:53 PM



All times are GMT -4. The time now is 04:37 AM.


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