943,779 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 425
  • C++ RSS
Nov 20th, 2008
0

Hey all, a little help needed

Expand Post »
Hi there, new to the community and first of all just wanted to say its great to be here. I'm rather new to C++ and i was having an issue perhaps someone could clear up for me.

Alright, our instructor for a class im taking would give us simple programs that we needed to make little additions/manipulations to. "end1" would coincide with text that was in quotations. From what i understand the use of "end1" is to help ensure text in quotations compile and execute more accurately? Here is an example just to illustrate my point.
C++ Syntax (Toggle Plain Text)
  1. #include<iostream>
  2.  
  3. using namespace std ;
  4.  
  5. int main() ;
  6. {
  7. cout << end1 ;
  8. cout << "Hello world." << end1 ;
  9.  
  10. return (0) ;
  11. }
For some reason whenever i try to compile my own code while including "end1", I get errors stating that "end1 is an unknown identifier". I apologize for not having the exact code and errors to copy and paste here but im at work at the moment. Just looking for any direction here as to why it might be giving me this error. Appreciate your time guys and have a great day

-alias
Last edited by Narue; Nov 20th, 2008 at 12:15 pm. Reason: added code tags
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
alias120 is offline Offline
24 posts
since Nov 2008
Nov 20th, 2008
0

Re: Hey all, a little help needed

it isn't "end1" but "endl" (with an "el" not a "one")
The endl is short for "endline" and makes the console jump to a new line.
cout << "Hello world.\n"; would have the same effect.

For future posts: if you post code here please use code-tags
Last edited by Nick Evan; Nov 20th, 2008 at 11:28 am.
Moderator
Featured Poster
Reputation Points: 4142
Solved Threads: 394
Industrious Poster
Nick Evan is online now Online
4,132 posts
since Oct 2006
Nov 20th, 2008
0

Re: Hey all, a little help needed

oh wow, i feel dumb. Well that makes a lot of sense, i appreciate the response. Ill be sure to use the code-tags.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
alias120 is offline Offline
24 posts
since Nov 2008
Nov 20th, 2008
0

Re: Hey all, a little help needed

Yea you do not have to use the parentheses around the 0 either after return.

You can just do return 0;
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008
Nov 20th, 2008
0

Re: Hey all, a little help needed

Alright sounds good, i didnt know whether that was required or not i was just going off the format provided by our instructor. My only programming experience pre-C++ was python, and even that was fairly limited so im very open to any critiques/advice you all have. Been wanting to learn programming for awhile now.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
alias120 is offline Offline
24 posts
since Nov 2008
Nov 20th, 2008
0

Re: Hey all, a little help needed

I do apologize for the lack of code-tags btw, should have read the forum rules more closely. Just found you guys while im at work so bouncing around a lot between here and my work.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
alias120 is offline Offline
24 posts
since Nov 2008
Nov 20th, 2008
0

Re: Hey all, a little help needed

I made a few changes for you. Good luck with the C++. This website is very helpful.

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2.  
  3. using namespace std ;
  4.  
  5. int main()
  6. {
  7. cout << "Hello world." << endl;
  8.  
  9. return 0;
  10. }
Reputation Points: 10
Solved Threads: 0
Light Poster
davids2004 is offline Offline
43 posts
since Nov 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: hello guys... help required...
Next Thread in C++ Forum Timeline: a question about atltypes.h





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC