cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/26/13:17:27

From: Felix Natter <f DOT natter AT ndh DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: cout and cin
Date: 26 Nov 1999 17:55:14 +0100
Organization: Customer of NDH Netzwerkdienste Hoeger GmbH
Lines: 33
Message-ID: <m3puwxw5u5.fsf@mybaby.home.felix>
References: <19991126104845 DOT 16521 DOT 00000398 AT ng-fp1 DOT aol DOT com>
NNTP-Posting-Host: port162.bonn.ndh.net
Mime-Version: 1.0
X-Trace: passat.ndh.net 943635310 12362 195.94.93.162 (26 Nov 1999 16:55:10 GMT)
X-Complaints-To: abuse AT ndh DOT net
NNTP-Posting-Date: 26 Nov 1999 16:55:10 GMT
User-Agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) Emacs/20.4
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

cavgp AT aol DOT com (CAVGP) writes:

> Hello there,
>        cout << ("The number entered was" << x << "and" << y << "\n");

you have to leave out the brackets:
cout << "The number entered was" << x << "and" << y << "\n";
that's afaik because without explicit parentheses the expression
is evaluated in the other order:
((((cout << "The number entered was") << x) << "and") << y) << "\n";
(if you don't know what that means, simply leave out the parentheses)

> 2)undefined reference to cin 'istream:: operator >> (int&)
>      cin >> a;

I'm not quite sure, have you tried to pass a pointer to an int to
operator>> (printf-style ;-)?

this works:
int a;
cin >> a;

> Are cout and cin still valid using the new GCC from 2.95.2?,, and

the short answer is yes,
the long is afaik that there has been a new standard accepted,
and gcc currently implements the old one

good luck

-- 
Felix Natter

- Raw text -


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