|
| Submitted on: |
9/21/2000 9:36:38 AM |
| By: |
Amin Patel1
|
| Level: |
Beginner |
| User Rating: |
By 51 Users |
| Compatibility: |
C++ (general), Microsoft Visual C++, Borland C++, UNIX C++ |
| Views: |
52609 |
|
(About the author) |
|
|
|
This tutorial has been made for new c++ programmers. Unfortunately their are many great minds out there but they don't have access to free and quality c++ tutorials.
|
| |
Terms of Agreement:
By using this article, you agree to the following terms...
- You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
- You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
- You may link to this article from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
|
 |
Planet
Source Code -
Start with a prayer to God, that you
“Succeed in learning C++" |
|
| |
|
Only at PS Code
-
Code of the Day
To join the 'Code
of the Day' Mailing List click
here!
| Thank you for coming to Planetsourcecode |
|
 |
|
|
Almost every time the teacher
gives lesson in school, we might copy everything from
the board or make notes over what is taught. There is
a similar thing we call in c++, ‘Comments’.
Comments can be used for different purposes.
ˇ
The most obvious one, to recall the
purpose of the code (Say you are referring to it after
6 months, makes less sense then. If you don’t
include a comment.)
ˇ
Helps your computer teacher know what
you have actually written. Just kidding.
ˇ
Now this one is an unobvious reason.
Sometimes after compiling you might want to
remove some line just to see how your program works
then, without deleting the actual code.
ˇ
The final one, just a good programming
style to express your thoughts.
Comments can be written anywhere
in the program (Good Feature). They don’t effect
your code, unless you comment out something by
mistake.
There are two types of comments:
- C
Style:
/*
You can write anything that
makes sense here */
After the introduction of c++ it
just become a norm for programmers to ‘Comment
out’, huge parts of their code using this style.
The initial part (/*) and the final part(*/) can be on
separate lines.
E.g.:
- #include
<iostream.h>
- int
main()
- {/*
- cout<<
“ This whole line gets, commented
out!”;*/
- }
|
<Warning:
The numbered indentation is not to be included with
the code while typing. It is only for your
convenience>
- C++
Style
//
After the 2 slashes, you can
type anything that makes sense.
This comment style is used more
often these days but please note that if your comment
sentence goes over many lines, please use // on each
line at the beginning.
E.g.:
- #include
<iostream.h>
- int
main()
- {
- cout<<
“How are you I am fine”;
- //
Line 4 will print
- //“How
are you I am fine, to the screen.
- //
Notice that
- //I
placed the 2 slashes on this line too.
- }
|
|
|
|
|
|
| Note:
If anything appears wrong, it is due to the incompatibility
of the browser. |
| For compiler compatibility issues
please refer to tutorial
3 |
| Users
of Netscape have complained regarding misprinting of C++
style comments but I can't verify that since I use IE, but
kudos to the Netscape user helping me solve the endless
comments problem due to browser incompatibility.
|
|
|
|
|
<-- content_end-->
|
|
|
|
|
|
Other 3 submission(s) by this author
|
|
Report Bad Submission
|
Your Vote
|
| |
Other User Comments
|
9/21/2000 5:43:15 PM: krane
keep these tutorials coming!@#@! this is what i have been looking for and im sure alot more people are too@#@! (If this comment was disrespectful, please report it.)
|
9/21/2000 10:56:31 PM: Amin Patel
Thank you very much! (If this comment was disrespectful, please report it.)
|
10/5/2000 10:43:52 PM: Ian Ippolito
I've just removed a slew of off-topic comments. Ian PSCode Admin (If this comment was disrespectful, please report it.)
|
10/8/2000 9:30:58 PM: Sebastian
Very nice and clean article, just can't wait until the little more advanced stuff comes :-) (If this comment was disrespectful, please report it.)
|
10/9/2000 9:34:16 AM: Koeter
Nice Tut ! I#d like to see more :o) (If this comment was disrespectful, please report it.)
|
10/16/2000 10:21:00 AM: Roland
Nice tutorial. I am not new to programming, but I am new to C++. The few books I've picked up on the subject are indepth, but lack the 'being schooled' programmer's perspective. Keep up the good work and I'll be tuning in for future tutorials! (If this comment was disrespectful, please report it.)
|
1/21/2001 7:59:24 PM: Craig
Good approach for beginners! Your tutorial taught me how to use my command-line compiler (although I now use Dev-C++[great IDE]) I think some links would be helpful, as well as some terminology so the people you start off can learn more.
PS. do you know of a good non-MFC Win32 API tutorial? (If this comment was disrespectful, please report it.)
|
1/21/2001 8:01:46 PM: Craig
Good approach for beginners! Your tutorial taught me how to use my command-line compiler (although I now use Dev-C++[great IDE]) I think some links would be helpful, as well as some terminology so the people you start off can learn more.
PS. do you know of a good non-MFC(vc++) Win32 API tutorial? (If this comment was disrespectful, please report it.)
|
9/25/2001 9:03:28 PM: Daza
These tutorials r great i have learnt stacks. keep them coming. 10/10 Daza (If this comment was disrespectful, please report it.)
|
10/1/2001 7:54:17 AM: Tore
Thanks for the tutorial. "Moo i am a flying cow mooo", . (If this comment was disrespectful, please report it.)
|
11/11/2001 3:09:14 PM: imn0thing
this tutorial does nothing but show how to use comments. and besides that, your explanation is ridiculously poor. why are people voting anything above 1 for your tutorials? (If this comment was disrespectful, please report it.)
|
7/13/2002 10:20:06 AM: john gibson
I have done a fair bit of c and vb and am now about to learn c++. I've already started reading and experimenting a bit and with my knowledge of c, there was nothing new here for me. However, this is a fact, not a negative comment. It seems amazing to me how a school pupil can give an outline of the basics in such a clear and concise way where many (or almost all) of the books I've looked at are so confusing. This will be a great help for those without pre-existing knowledge of c or c++. Well done. (If this comment was disrespectful, please report it.)
|
1/30/2003 2:55:54 AM:
Reading the comments that people have made, it seems as though no one has even read the tutorial. A clear and concise outline of the basics? Taught me how to use my command-line compiler? Good grief. And don't use #include , not in your code and certainly not in a tutorial. You should have and . (If this comment was disrespectful, please report it.)
|
1/30/2003 2:57:07 AM:
\ and \. (If this comment was disrespectful, please report it.)
|
1/30/2003 2:58:49 AM:
Great. I meant, you should have (left angle bracket) iostream (right angle bracket) and (left angle bracket) ostream (right angle bracket) (no spaces). (If this comment was disrespectful, please report it.)
|
3/25/2003 11:44:52 AM:
Im not that new to c++ programming and i know the mateiral you are discussing...but i like your approach. Lots of tutorials and books etc... dont teach it right. They make it sound hard...and complicated...self teaching this stuff gets hard when the teachers are making it difficult and technical (If this comment was disrespectful, please report it.)
|
7/2/2003 11:37:45 AM: Justin W.
This is a great tutorial but I sort of think you put too much effort into the whole template of pscode thing. This tutorial could have been written in just a few lines. Hope there are more tutorials coming. (If this comment was disrespectful, please report it.)
|
9/2/2003 4:20:40 AM:
Fantastic Tut, Keep up the good work! (If this comment was disrespectful, please report it.)
|
10/17/2003 5:49:15 PM:
Your tutorials are ausome make more. i just started they helped me a lot (If this comment was disrespectful, please report it.)
|
4/2/2007 12:23:38 PM: set
i dont get it is it just me or when i run the program it close the same second how to change this btw i give you 4 for not rtping that (If this comment was disrespectful, please report it.)
|
7/19/2008 12:50:02 PM: Kaito-kun
Well, It was very very easy to understand..Inputting notes into your command lines ready does make it easier to know what it means with a quick glance
good work 5/5 (If this comment was disrespectful, please report it.)
|
4/28/2009 5:28:15 PM: Adila Afshan
Nice
(If this comment was disrespectful, please report it.)
|
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)
To post feedback, first please login.
|