delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/13/05:39:20

Message-ID: <8D53104ECD0CD211AF4000A0C9D60AE3012DE133@probe-2.acclaim-euro.net>
From: Shawn Hargreaves <ShawnH AT Probe DOT co DOT uk>
To: djgpp AT delorie DOT com
Subject: Re: Help! One dimensional arrays aren't working!
Date: Tue, 13 Apr 1999 10:38:56 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.0.1460.8)
Reply-To: djgpp AT delorie DOT com

thethoms <thethoms AT pacbell DOT net> writes:
> while (class[counter]!=-1)
>	{
>	Sample=pow((class[counter]-Mean),2)
                                          ^^^
                                 (missing semicolon)

>	}
> StdDev=sqrt(Sample/(classnumber-1))
                                    ^^^
                           (missing semicolon)

> When I compile this program, where ever there is a statement like:
>
> class[XXXX]
>
> I receive an error from the compiler:
>
> Parse error before XXXX

That's because "class" is a C++ keyword. You can't use it for anything
else like a variable or function name. You need to choose a name that 
isn't a reserved word.

> I have had my C++ instructor look at these statements, and she 
> can't seem to find anything wrong.

Hehe. Why is it that computing teachers never seem to know how to
program? :-)


	Shawn Hargreaves.

- Raw text -


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