www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/08/09:35:52

From: Ed <Ed AT www DOT anything DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: extreeeeme newbie question
Date: Thu, 08 Apr 1999 13:46:58 -0700
Organization: GEC
Lines: 22
Message-ID: <370D15C2.172B@gec.nospam.com>
References: <7ehdb0$3o2$1 AT fir DOT prod DOT itd DOT earthlink DOT net>
NNTP-Posting-Host: pc02372.gmsws.gecm.com
Mime-Version: 1.0
X-Mailer: Mozilla 3.01C-GECMMTL (Win95; I; 16bit)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Jason Nehf wrote:
: #include <iostream.h>
: #include <conio.h>
: 
: int main()
: {
:     clrscr();
:     cout << "Hello, world!";
:     getch();
: }
: 
: But for some reason, the getch() is called first, THEN the cout, and 

Terminate the Hello WorlD! string with a << endl; or \n"
or fflush(stdout);

Without any of these the string may not appear on the stdout
then the getch() will be executed and the buffer will be
flushed after the getch. Making it look like they are being
executed in the wrong order.

Ed

- Raw text -


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