Thread: Newbie Help

  1. #16
    C/C++ Programmer
    Join Date
    Sep 2004
    Posts
    2
    You should really never use void main()
    People only use it to stop errors from showing up in some programs like vc++ to dev C++ ect...

    Just stick with int main() and dont' forget to add the return 0; *Its not needed but if your working on a team project it can cause an error and no one wants to go back and add it if your code is like 1000+ lines.

    Oh well I'm new anyways so I may be wrong but I doubt it from personal experince.

    Happy programming! Burn that book while your at it. Heh!

    EDIT:

    Here is an example:

    #include <iostream.h>
    int main()
    {
    cout << "Hello World!\n";
    return 0;
    }
    Last edited by chrjampaw; 09-02-2004 at 05:12 PM. Reason: Forgot to add an example.

  2. #17
    Registered User jlou's Avatar
    Join Date
    Jul 2003
    Posts
    1,090
    Hey chrjampaw,

    As long as you are giving advice not to use void main, I'd advise you not to use <iostream.h> for the same reason. It is non-standard (like void main) and is used for backwards compatibility with older compilers (like void main). Switch to <iostream> like a few of the examples in this thread have already shown.

  3. #18
    C/C++ Programmer
    Join Date
    Sep 2004
    Posts
    2
    Quote Originally Posted by jlou
    Hey chrjampaw,

    As long as you are giving advice not to use void main, I'd advise you not to use <iostream.h> for the same reason. It is non-standard (like void main) and is used for backwards compatibility with older compilers (like void main). Switch to <iostream> like a few of the examples in this thread have already shown.
    I already know to type:

    <iostream> without the h, but Im not trying to confuse him to do it with all of the include files which are headers.

  4. #19
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    Actually it would probably be less confusing to come out and say not to use .h. Best to get into the habit early on than to have to learn it months later because a compiler he is using doesn't accept it.

  5. #20
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >here's a link to the tutorial on this site (it's got the guaranteed approval of all the gurus around here ):
    Not as it is, no. When our venerable webmaster gets around to updating the tutorials with something standard the gurus will be satisfied.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newbie: array question :(
    By cstudent in forum C Programming
    Replies: 2
    Last Post: 04-09-2008, 06:46 AM
  2. getting to grips with allegro and ms vc++ (newbie)
    By jimjamjahaa in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2005, 07:49 PM
  3. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 12:53 PM
  4. Some help for a newbie?
    By Ilmater in forum C++ Programming
    Replies: 23
    Last Post: 04-19-2004, 07:44 PM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM