cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/16/15:00:43

From: "Michael Stewart" <mike AT reggin DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: CANNOT GET ANYTHING TO WORK!!
Date: Sat, 16 Jan 1999 19:31:28 -0000
Organization: Customer of Planet Online
Lines: 40
Message-ID: <77qpmo$8su$1@news6.svr.pol.co.uk>
References: <36A06C85 DOT 3A8C AT virgin DOT net>
NNTP-Posting-Host: modem-41.vanadium.dialup.pol.co.uk
X-Trace: news6.svr.pol.co.uk 916515352 9118 62.136.11.41 (16 Jan 1999 19:35:52 GMT)
NNTP-Posting-Date: 16 Jan 1999 19:35:52 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Lozza wrote in message <36A06C85 DOT 3A8C AT virgin DOT net>...
>Path is fine...
>
>Must be the code - can anyone help ?
>
>#include <iostream.h>
>
>int a, b, c;
>
>void main()
>
>{
>cout << "Give me a number for A. \n";
>cin >> a;
>cout << "\n\n Give me a number for B. \n";
>cin >> b;
>cout << "\n\n Give me a number for C. \n";
>cin >> c;
>cout << "The average for A B C is:  " << (a + b + c) / 3;
>return ;
>}
>
>I know iostream.h is not available - anyone any other ideas? Keep
>getting undeclared variable for cout, cin etc.. Thanks.

The code itself should work. The only thing I can suggest is, make sure you
are using the .cpp extension as cout and cin are C++.
If you have compiled it using the .c extension gcc will think the code is C
and not C++.

/pendantic
you should decare main as an int and return an int. eg
int main () {
...
   return (0);
}
/end pendantic



- Raw text -


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