RE: Problem solved with syntax errors on this code, I feel foolish.

  • From: "Joseph Lee" <joseph.lee22590@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 10 Jul 2010 22:50:22 -0700

Hi,
Nice - at least you've learned something valuable...
Cheers,
Joseph

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Jes
Sent: Saturday, July 10, 2010 10:45 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Problem solved with syntax errors on this code, I feel foolish.

Well, I figured it out. To many semicolons. You don't need a semicolon ;
character until you are completely done with your C++ statement. In effect,
in C++ statements, the semicolon is like putting a period at the end of an
English sentence. I was typing:

cout << "this "; << endl;
When in reality, I should have typed:
cout <<"this" endl;
I was putting the semicolon in the wrong place, making the compiler think I
was ending one C++ statement.  Then it didn't know what to do with the
<<endl; part of the code, since both statements were on the same line, it
treated them as one statement. And of course, the compiler isn't smart
enough to realize that the << endl; is part of the same statement, so it
thinks you've completed a statement, when in fact you haven't. Wow, I'm
actually learning something here.
Jess

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.5.441 / Virus Database: 271.1.1/2992 - Release Date: 07/10/10
19:59:00

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: