delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/29/03:49:43

From: G DOT DegliEsposti AT ads DOT it
To: djgpp AT delorie DOT com
Message-ID: <C125659B.002F4E8A.00@vega.ads.it>
Date: Thu, 29 Jan 1998 09:45:52 +0100
Subject: Re: cout problem
Mime-Version: 1.0




>maybe if you say also *which* error you got
>
> Sorry, I thought that I mentioned this in my original posting. The error
I got
> was that cout was used without being initialized first. But, according to
the
> documentation, libio.h does initialize cout, as well as cin and cerr. The
> listing again:
>
> #include <libio.h>
> void main()
> {
>   cout << "Hello World!/n";
> }

sorry... I could not find it... maybe I didn't see that you had posted two
messages? Anyway:

use <iostream.h> in stead of <libio.h>. cin cout and cerr are declared
there.

BTW: remember to use "int main()" in stead of "void main()". This is the
ANSI
standard definition for main and in some systems other then DOS void main
causes
some problems.

One last thing (sorry :-) is: "/n" is not the newline char. It is "\n"

ciao
  Giacomo





- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019