C++ Tutorial I – Hello World!

1 minute read

Many consider C++ to be cliche and a bit ancient. But nonetheless, it is great for beginners who want to start programming, but don’t know where to start. If you learn C or C++, Objective-C becomes much easier to learn. And believe us, Objective-C is not for beginner programmers.

Before you get started programming in C++, you should have a IDE. For Windows, I suggest Bloodshed Dev-C++. For Macintosh, Xcode is ideal, with Eclipse for C++ being another choice (Eclipse is also available for Windows and Linux).

Anyhow, take a look at the C++ code: (Bold is C++, text after “//” is a comment. That is, it isn’t run when the program is compiled.)

 


#include </strong> //imports the basic output/input libraryusing namespace std; //without this, you woud need to type “std::” before most lines of code in your program</p>

int main() //the main function of the program; starting point of all C++ programs

{ //left curly bracket; it begins/opens the main function

cout <<“Hello World!”; //cout is what you tell the program to say to the user; this outputs “Hello World!” in the console window

system(“pause” ); //This tells the program to pause the program so that the user can actually see what is output on the screen; use this if you are running the program on Windows, don’t use this on Macintosh or Linux

cout << endl; //outputs a line break, all further output is done on the next line

return 0; //Tells the computer that the program ran successfully

} //right curly bracket; this ends/closes the main function</td> </tr> </tbody> </table>

 

And now you know how the program works! Enjoy!

As you can see, it says Hello World! on the paper!!!!!!!

Leave a Comment