C++ Intro...

Submitted on: 1/1/2015 12:49:00 PM
By: Amin Patel1 (from psc cd)  
Level: Beginner
User Rating: By 87 Users
Compatibility: C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
Views: 2547
     This tutorial has been made to give an introduction to new c++ programmers. Unfortunately their are many great minds out there but they don't have access to free and quality c++ tutorials. So this is the first lesson.


C++ Intro…                                       By: Amin Patel

Before you write your first program. Start with a prayer to God, that you “Succeed in learning C++”.


Now that all your hopes are high let us start. Please enter the following code exactly as shown, without any questions. (This is to inform you that the explanation will follow after the code.)


  1. #include <iostream.h>
  2.  int main()
  3. {
  4. cout<< “ What you do is what you get”;
  5. }



Although this may sound strange, once you compile this program you are a programmer.

<Warning: The numbered indentation is not to be included with the code while typing. It is only for your convenience>


Now let us read the first line. You read it as “Hash/Pound include eye-oh-stream-dot-h”


Iostream: Input Output stream. Don’t learn the definitions they automatically come to you.



You don’t pronounce the brackets while reading it loud, but is it a part of the code.

.h: Dot h files are known as header files. We place them in the beginning of the source code; it is like adding a DVD-Player to your deck. You don’t create .h files for now, nor would you add a DVD-Player to your deck each time you want to use it.

Iostream.h: Ok now you know what iostream and dot h stand for. If the terms input & output haven’t shed any light yet, keep reading. Iostream lets your program accept info/data/content or publish the same to the screen.


Wait we are still on the first line. Read the first line of source code again!


“Hash/Pound include eye-oh-stream-dot-h”


The Hash include is the standard form for telling the compiler that you want to include the Iostream.h file.


Now on line 2 we have int main().  Int is read as integer, read main() as main function. Without line 2 your program cannot work. On line 3 and 5 you have these {} braces.


Between the 2 braces all your code fits in. Make sure you enter line 4 exactly as it is. Pay attention to the punctuation.

Cout: See cout – It is the command with which you display text onto the screen


The << on line 4 is the redirection symbol produced on most keyboards by holding the shift key and pressing the comma key twice. The text in between the quotation marks, in the case “What you do, is what you get” is what shall be displayed onto the screen when you run the program.


Line 4 ends with a semi colon, don’t forget to type that, almost all c++ statements end with that. Now you may finally link, build and compile the code. Now you receive a message on a black terminal (Dos like): “What you do is what you get”


Congrats - You are now officially a programmer and that too c++.


I plan to write more tutorials when I can dedicate some time after school. If you like this code please give me a good message. I do need messages occasionally like “Thanks”, with all the pressure I face from school. If you have gained knowledge from this tutorial please make me happy.

Other 2 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

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.