Thread: goal is to write a telephone directory

  1. #1
    Registered User
    Join Date
    Dec 2003
    Posts
    1

    goal is to write a telephone directory

    I want to be able to add and remove poeple from the directory This is what i have so far except i have 5 errors and not sure how to correct them.

    error 1 is a syntax identifer GetInfo at the top of pg 2
    error 2-5 is a local funct. are illegally defined

    not sure what went wrong or how to fix them. I did a flow chart before i started this project and i have eareased andn updated and now confused

    Am i going in the right direction on this program

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    The way you avoid them in future is by not writing so much code in between pressing compile.

    Typing in 100's of lines, then getting hundreds of errors is not the way to go
    Posting the whole mess on a message board isn't the way to go either.

    Code:
    void my_new_func ( int a, char *b ) {
    }
    I've just added two lines to a program, I can now press compile and if all is well, it will compile.

    Code:
    void my_new_func ( int a, char *b ) {
        for ( int i = 0 ; i < a ; i++ ) {
        }
    }
    I can press compile again, and it will still compile. If it doesn't, you examine the for loop you tried to add.

    void my_new_func ( int a, char *b ) {
    for ( int i = 0 ; i < a ; i++ ) {
    cout << b << endl;
    }
    }
    Wow, the function is complete and it compiles.

    The point being, if you've only added a few lines and you now have a new error, you've got a damn good idea that the new problem is with the few lines you just added.

    > error 2-5 is a local funct. are illegally defined
    Almost certainly, the function which is before the first "local" function is missing a closing brace
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to tell if a file or directory
    By swappo in forum C++ Programming
    Replies: 4
    Last Post: 07-07-2009, 10:57 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. accessing all files in a folder.
    By pastitprogram in forum C++ Programming
    Replies: 15
    Last Post: 04-30-2008, 10:56 AM
  4. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  5. Finding files in a directory
    By smarta_982002 in forum C Programming
    Replies: 1
    Last Post: 01-25-2008, 10:10 AM