C++ Intro (Part 1) by Amin PatelBefore 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.)
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”
You don’t pronounce the brackets while reading it loud, but is it a part of the code.
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++. Add your tutorials to this site Mail Me
|
||||
GauravCreations's Store / Home / Register / Awards / Opinions / Downloads / Query |
||||
Copyright © 2001-04 [Gaurav Creations]. All rights reserved |
||||
|