iostream.h help???

This is a discussion on iostream.h help??? within the C++ Programming forums, part of the General Programming Boards category; Im a newbie to the c, c++ enviroment, but im actually coming along pretty well. I d/led borland 5.5 free ...

  1. #1
    chaoticseedalpha
    Guest

    Angry iostream.h help???

    Im a newbie to the c, c++ enviroment, but im actually coming along pretty well.
    I d/led borland 5.5 free compiler, and i also have djgpp!
    I was able to make a simple prog using this code:

    #include <stdio.h>
    int main(void)

    {
    printf("Hello World!\n");
    return 0;
    }

    'and it works.

    Now i went to a lot of websites with beginning tutorials that did this same prog but in a different way:

    #include <iostream.h>
    int main()

    {
    cout << "Hello World!";
    return 0;
    }

    'This doesn't work for me!!
    And a lot of tutorials use this method, i want to learn more , but i can't follow any tutorials since they use this method.
    If n e 1 can hlp, its much appreciated.

    If this is the wrong forum, plz forgive me!
    lata'

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    reply

    The syntax looks correct. What errors do you get? Assuming you have iostream.h and its components that code should work...

    And this is definitely the right forum
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    The first example is "old" C style I/O the second is "new" C++ stream I/O. Both are useful, (but avoid mixing them in the same program on the same I/O channel!!!).

    Change the second to this...

    Code:
    #include <iostream> 
    using namespace std;
    
    int main() 
    { 
       cout << "Hello World!"<<endl; 
       return 0; 
    }
    ... and see how your compiler likes it.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    chaoticseedalpha
    Guest

    hmmm, nope!

    Well my computer didn't like that code snippet, and i have iostream.h.
    Whenever i try to use the <iostream.h> and COUT, and try to compile it says no such file or directory!!!
    maybe its in the wrong dir, or do i have to put it in a certain area?
    thx!

  5. #5
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,825
    Did you have it just like adrian's example? With no 'h' on the iostream?

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    What compiler are you using? It may be C only.

    -Prelude
    My best code is written with the delete key.

  7. #7
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> It may be C only.

    Well, he said he was using B5.5. I know that is B's current C++ compiler, BUT, of course, it may be configured for C. Do you know if that is possible with that compiler?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  8. #8
    chaoticseedalpha
    Guest

    yep...

    Yes, I took the .h out of <iostream.h> ---> <iostream>.....
    And i have djgpp(Is that C only?)
    And Borland 5.5 C++ Builder, which should be able to handle the iostream.h, right?

  9. #9
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    >>> which should be able to handle the iostream.h,

    Any C++ compiler should be able to handle a header in xxx.h format, it is, however, not the currently preferred way of doing it. You should be using the newer form, (without the ".h"), and then specifying the namespace(s) you want to use. (Don't worry about namespaces just now, just make sure you include the std namespace, otherwise your compiler won't be able to find anything).

    So your telling us that the code I gave you, (EXACTLY the code I gave you), will not compile with either of your compilers? It compiles and runs just fine with VC++.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  10. #10
    chaoticseedalpha
    Guest

    dammn...

    alright, now i can't compile a prog using borland...
    Now it says ya hav to put a line in the autoexec...
    which i hav.
    this is it, but does it look right.

    PATH=%PATH%;"C:\Borland\BCC55\bin"

    Bcoz when my computer restarts it says too many parameters.

    ??

  11. #11
    chaoticseed
    Guest

    Talking GOT IT!!!!!

    Finally, I got the bcc32 working and your code snippet works fine!!!!!! Thx for every1ns hlp, much appreciated!
    May this forum live forever and ever!!!
    lata'

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. iostream.h
    By SirCrono6 in forum C++ Programming
    Replies: 4
    Last Post: 02-03-2006, 01:23 AM
  2. Including iostream.h
    By DvdHeijden in forum C++ Programming
    Replies: 7
    Last Post: 01-15-2005, 12:23 PM
  3. iostream.h (vs) iostream
    By Brain Cell in forum C++ Programming
    Replies: 5
    Last Post: 11-05-2004, 08:20 AM
  4. Depreciated/antiquated iostream.h
    By ThePyro in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 04-26-2004, 02:23 PM
  5. stdio.h vs iostream.h
    By Hiroyuki in forum C Programming
    Replies: 2
    Last Post: 03-13-2002, 09:21 PM

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