Archived

This topic is now archived and is closed to further replies.

C++ end1 error

This topic is 5721 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

When i type in the code in c++ then compile my work an error comes saying: C:\My Documents\Cpp2.cpp(6) : error C2065: ''end1'' : undeclared identifier what causes that and how should i fix it Thunderstorm Games

Share this post


Link to post
Share on other sites
Post some source code. You''ve either misspelled a variable/function reference as ''end1'', or you''ve forgotton to declare it. ->For Beginners

Share this post


Link to post
Share on other sites
This is the code im trying to put in:

#include <iostream>
using namespace std;

int main( void )
{
cout << " /\\ " << end1;
cout << " / \\ " << end1;
cout << " / \\ " << end1;
cout << " | | " << end1;
cout << " |[] [] |" << end1;
cout << " | |" << end1;
cout << " ----- " << end1;

return 0;
}

Thunderstorm Games

Share this post


Link to post
Share on other sites
end1 has to be endl;

I will spell it out, to make sure.

E - N - D - L - ;

Share this post


Link to post
Share on other sites
Haha, yes, endl. (as in end line)

cout << "My text" << endl;
or even
cout << "My text\n";

/n is the newline character.


---
"May you live all the days of your life."

Share this post


Link to post
Share on other sites
\n is not the same as endl in c++. endl flushes the buffer, but \n doesn''t (altough it does in plain c).

-Neophyte

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com

Share this post


Link to post
Share on other sites