Introduction

Hello all you C++ wannbe's out there. Here is some help for you if your really starting at the bottom of the line. This guide will lead you off to a good foundation of C++ programing, thus I presume that from this you will get some motivation to fulfil your programers destiny! C++ , just like any other progrming language, requires alot of time and patience. So after this guide, you may start to notice what some people are writing in those confusing programing code you see in all those threads.

Who is this guide intended to?

This guide is basicly for the people the look around the C++ threads, and they are ashamed they cant ask a question for they might sound stupid because they dont know enough of the subject. Well this guide will just be the tip, the vey tip of the iceberg on what C++ has to offer.

Chapter 1 / Your first hello world program

Now, as in any other programing language, the best way to start is by a hello world program. A hello world program is basicly a little program you write so something will show on the screen, or you could call it screen display. First im just going to tell you how to create your own workspace. I do assume you have visual C++ or any other complier, so go in there, and try to clear your mind. Now you can see that in the middle there is a gray background, and on top alot of little confusiing buttons. On the very top, you can see file, go there, and choose new on the very top of the pop down menu. You will see a Box come up with confusing stuff like win32, ISAPI,ATL COM, and MFC. Dont worry, dont get nervus, just go over to the Win32 Application choose it and you wil see a dialog named Win32 Console Application - Step 1 of 1. This dialog is whree you set the initial attributes of the projects. In other words, you set its settings for the current project you want to have. Now just do the settings to your desire, which I will let you experiment on, and then click ok and viola, you got your self a workspace. Now whats missing? Files, you need to create a source file in the project you just created. dont be confused, it should make sense sooner or later.

*HINT*

Best way to learn anything is to experiment, and from your experiece comes the best lerning source, so I dare you to experiment a little in C++, get ur self a little bit more fimiliar.

Creating and Adding Files

Now the you have your project, you need to add new files to it. You can do that by selecting the menu project, add to project, new. That will display a dialog similar to the one you just created. Now do you see the tabs on top o the dialog screen? Your curreently under projects. Move to the tap that says Files. done?? good job. Now in files you will also see alot of confusing stuff. Dont worry about them, just scrool down to C++ Source File and create it. Thats all ladies and gentle men, you now have a complete workspace.

The Code For Your First Program

In the source files, you should type the following, I know you wont understand squat, but dont worry, all will be explained nearly after.

PHP Code:
/* Your First Program */

/* Input Output Stream Header File */
#include <iostream>

/* Start */
main (void)
{
 
std::cout << "Hello World" << std::endl;
 return 
0;

Now your going lke what the hell did he just do??? That should be what your asking, good, were on the right track. As you can see on the top /* enclosing with a */ , thats just to write comments. #include, to put it short is a preprocessor directive, on whcih you will dig the details later; for now, just think of it as a way to include from another file in your own file, in this case, the code iostream. Use the < > to encapsulate the header file, so you tell the complier to look on the defult include directory. If you use qutation marks, that means that the complier will use the project directory to look for the header files.

*CAUTION*

Header files usually have the .h extention. There are two iostream files, one with the .h, and one without it. I use the one without .h because it is the ANSI/ISO C++ standard. Using the iostream file instead of the iostream.h file makes yuor code compatible with many different compliers.

You can seperate iostream into two like this: io stream. io stands for input output, and stream is the way u communicate with the computer files, screen, keyboard, and more.

Now for main. When you try to run a console program, the opertaing system will call the main function. You are defining main in your program as accepting no arguments, or more correctly, no command-line argumetns. You do this by enclosing void, which means there are no paramiters inside tje parentheses following the main keyword. Sorry about the big and confusing worsds, but somethings cnot be explained without being confusing.

Now lets look at the { } brackets enclosing the brogram. If you have brackets enclosing code, its called a code block. Thats all you need to know, besides to use them when ur writing programs.

Now over to the confusing std::cout. cout (pronounced see out and is (c) console (out) output is the code that makes things appear on your screen. std is only a namespace. To be albe to use any member or method of the std namespace you need to use the :: (token) to specify that cout belongs with std.

Now to strings. As you saw when I wrote "Hello World", notice the brackets around the words. If brackets enclose any words, they are Strings.

Now to the << (insertion) operator. As the name says, it inserts whatever is on the right side of it, in your case, the string, into whatever is on the leftside, std::cout, and remember that cout displays anything with a insertion operator sign (<<) before it.

Now to the endl, its basicly makes a new line endl can be seprated into two words also: end l end modifies l which is line, so its basicly endline, but can only be used as endl. You can also use /n to make a seperate line like this: std::cout << "Hello World/n";

Last but not least the semicolen token. Never ever forget that. It terminates the end of the code thus giveing and end to it, without it, you will get errors upon errors, so make sure u use it in almost every line of code you have! except the #include <iostream> and main (void).
The End

Well ladies and gentlemen I hope u had fun and learned something from this, cuz I know I had fun. If by chance I might write another guide following up to this one, im not sure yet. But post any comments please onto this thread if this helped you or u got more questions. Thank you for your time.

-Alex

P.S. My email is [email protected] so email me for any particular reason you would have.

P.S.S sorry for my spelling, didnt have time to recheck it all.