your opinions???

This is a discussion on your opinions??? within the C++ Programming forums, part of the General Programming Boards category; Ok here i've one last question. I've consulted many books and is that my teacher told me to add: Code: ...

  1. #16
    Registered User
    Join Date
    May 2010
    Posts
    17
    Ok here i've one last question.
    I've consulted many books and is that my teacher told me to add:
    Code:
    #include <iostream.h>
    #include <conio.h>
    void main()
    before starting every program.
    But as i've found in many books including Deitel's book, here the code is such as:
    Code:
    #include <iostream>
    int main()
    {
      // your code
    return 0;
    }
    ~~Please clear my doubts for this. What's the difference between them??
    And can i use both for my compiler Borland C++??

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    23,773
    Quote Originally Posted by Aash
    What's the difference between them?
    <iostream.h> is a pre-standard header. It should not be used for new code. <conio.h> is a non-standard header. Whether you need it depends on what you are trying to do.

    Generally, void main is incorrect: the global main function should have a return type of int. However, as a special exception, there is no need to explicitly return from the global main function; a missing return statement is effectively the same as placing return 0; at the end.

    <iostream> is a standard header.

    Quote Originally Posted by Aash
    And can i use both for my compiler Borland C++?
    You can easily answer this question yourself. I suggest that you try the sample program on Stroustrup's compiler list. As Stroustrup asserts, "if an implementation cannot handle this simple program as written, it is not a good candidate for learning Standard C++", i.e., if your version of Borland C++, when configured correctly, cannot compile that sample program, then you should not be using it as your tool for learning standard C++.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #18
    Registered User
    Join Date
    May 2010
    Posts
    17
    @laserlight: I tried that simple program. As i'm using Borland C++ 5.02, so it gave 5 warnings on compiling. I typed the name but it didn't display the word "hello". After typed the name the program terminated. I need your guidance, which IDE should i've to use now??
    As i'm just in the begining stage.

  4. #19
    Registered User rogster001's Avatar
    Join Date
    Aug 2006
    Location
    Liverpool UK
    Posts
    1,468

    read posts

    the IDE question was answered earlier as was the code problem u could have solved by just messing about even if u didnt understand the message fully
    Thought for the day:
    "Are you sure your sanity chip is fully screwed in sir?" (Kryten)
    FLTK: "The most fun you can have with your clothes on."

    Stroustrup:
    "If I had thought of it and had some marketing sense every computer and just about any gadget would have had a little 'C++ Inside' sticker on it'"

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Opinions requested
    By jeffcobb in forum Programming Book and Product Reviews
    Replies: 8
    Last Post: 12-26-2009, 03:30 PM
  2. Replies: 6
    Last Post: 10-31-2009, 04:10 AM
  3. Opinions?
    By Decrypt in forum C++ Programming
    Replies: 1
    Last Post: 09-18-2005, 05:29 PM
  4. Favors and Opinions
    By sean in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 08-01-2003, 10:04 PM
  5. Need some opinions
    By Fool in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 12-17-2001, 06:39 PM

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