Can someone look through my code?

This is a discussion on Can someone look through my code? within the C++ Programming forums, part of the General Programming Boards category; I am in the process of making a program in Microsoft Visual Studio 2003 for a college project. The program ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    6

    Question Can someone look through my code?

    I am in the process of making a program in Microsoft Visual Studio 2003 for a college project. The program is very basic and it is about 50% completed.

    Basically you enter your details in the text boxes towards the right, and then click the enter button. A seat towards the right (one of the 10 labels) will display your first and second name. Double clicking a booked seat will display details in the text boxes at the bottom of the window.

    That is all I want so far and I have written the code but I am getting errors. I am new to programming and I made this program by copying a similar program (teacher said this is fine) and changing the code as well as adding extra things.

    Could someone have a look at my program and fix the errors for me please? Ignore the design, I know everything is misaligned, I will fix that later, I just want the program working. I dont want code rewritten, I would like it exactly how it is because this is the only way I understand.

    I have uploaded my program http://homepage.ntlworld.com/stephanie.mirza/AlphaJet's%20Booking%20System.zip

    Thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,671
    Assuming for a moment that the code compiled and did something before you made your changes, I would suggest you do the following.
    1. Put what you have to one side, and start over with a clean project containing just the code you have been given.

    2. Make very small changes (a few lines at a time), and press compile. If it doesn't compile, then look at what you did and fix it before moving on. Copy small parts of your previous attempt if you think you can use them.

    Eg this edit / compile sequence:
    Code:
    #include <stdio.h>
    int main ( ) {
      return 0;
    }
    
    /* Press "compile" */
    
    #include <stdio.h>
    int main ( ) {
      printf( "hello world\n" )
      return 0;
    }
    
    /* Press "compile" */
    /* Get an error message */
    /* Oops, forgot the ; - fix it and try again */
    
    #include <stdio.h>
    int main ( ) {
      printf( "hello world\n" );
      return 0;
    }
    
    /* Press "compile" */
    /* OK, back on track */
    
    #include <stdio.h>
    int main ( ) {
      for ( i = 0 ; i < 10 ; i++ ) {
        printf( "hello world\n" );
      }
      return 0;
    }
    
    /* Press "compile" */
    /* Get an error message */
    /* Oops, forgot to declare i - fix it and try again */
    
    #include <stdio.h>
    int main ( ) {
      int i;
      for ( i = 0 ; i < 10 ; i++ ) {
        printf( "hello world\n" );
      }
      return 0;
    }
    
    /* Press "compile" */
    /* OK, back on track */
    3. Every few iterations of step 2, you should be looking to running what you've just created to see if the new stuff you've added is doing what you want. If it isn't, think about how to fix it.

    4. When you've got a useful bit of functionality working, create a backup of your project for safe keeping.

    > Could someone have a look at my program and fix the errors for me please?
    No, we're here to help you understand what is going on, suggest things for you to try, or things to read.
    It is NOT a place to dump your coding attempts and expect someone else to fix it for you. You will never learn programming unless you can debug your own work.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901


    I thought #2 that was a big nono...

    I do it anyway.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    6
    It's a few errors, please help...

    This is a school project and I cant contact the teacher for help because we have a week off. The project is due in very soon and I have documentation to write.

    I wanted to learn C a few days ago, now I have changed my mind. I just want to get this done and then forget all about programming. If you cant be bothered to run my program, I will show you the error messages...

    When I try and run the program, I first of all get this....

    http://homepage.ntlworld.com/stephan...nt%20Error.JPG

    and then I get 4 errors

    http://homepage.ntlworld.com/stephan...3%20error1.JPG

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    You might want to use a constructor initialization list, although that doesn't fix your errors.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 05:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21