okay whats the deal with this error message " expected `;' before string constant "Code:#include <iostream.h> int main() { int x = 5; int y = 7; cout "n/"; cout << x + y << "" << x * y; cout "n/"; return 0; }
okay whats the deal with this error message " expected `;' before string constant "Code:#include <iostream.h> int main() { int x = 5; int y = 7; cout "n/"; cout << x + y << "" << x * y; cout "n/"; return 0; }
That'd be the deal. You need the << operator. Also you should stop looking at code through a mirror, because what you want is '\n' not 'n/'.Code:cout "n/";
..and also, if by "" you mean space, then you want " "
Last edited by SlyMaelstrom; 12-08-2005 at 06:57 PM.
Sent from my iPadŽ
That is an error. Reread the relevant section of your book on escape sequences.Code:cout "n/";
What do you think you are doing there?Code:cout << x + y << "" << x * y;
Code:#include <iostream.h> ---> <iostream>In the future mark the line in your code where the error is occurring with a comment or highlight it in red.okay whats the deal with this error message " expected `;' before string constant "
I wouldn't really call that an error since there is nothing illegal about it (the red part that is), but as I said, it's not gonna do what he expected.Originally Posted by 7stud
On a side note, to the author of this topic, I'd like to add that this is something you should have no problem debugging yourself. I can understand that little things like this sometimes don't pop out like they should because your tired and maybe have been staring at the screen too long. But the error you received was *syntaxual and it's the kind of thing you should make a good attempt at debugging yourself. Just a tip so you could one day become a very good programmer.
*No that isn't a real word.
Last edited by SlyMaelstrom; 12-08-2005 at 02:45 PM.
Sent from my iPadŽ
But 'syntactical' is one
don' t you also need like
using namespace std; or sumthin like that
Verbal Irony >>
"I love english homework!" When really nobody like english homework.
-Mrs. Jennifer Lenz (English Teacher)
In his case where he is including <iostream.h> he doesn't need to use the std namespace. If he were to switch it to <iostream> which is defined under the std namespace, he would need to use it in his program.
Sent from my iPadŽ
o and its supposed to be
and instead of the /n , use endl;Code:"/n"
p.s.
Thanks sly, im extremly rusty and I did not know that
Verbal Irony >>
"I love english homework!" When really nobody like english homework.
-Mrs. Jennifer Lenz (English Teacher)
>> o and its supposed to be "/n"
The correct point was already made. It should be "\n" or '\n', not "n/" or "n\" or "/n".