In this thread I will teach you a basic code you can do in c++
O.K, first off you may want to start off by downloading c++, also know as "Visual Basic C++ Express". Google it, you will find it
O.K have you downloaded it ? Good
1) To start off with we are going to make a new win32 console application so start up "Visual c++ Express" and click on new project or go to File -> New -> Project
2)Select "Win32 Console Application" and for the name type in Hello World ! and press ok
O.K now you will get a new project come up, on the left hand side should be the "Solution Explorer". Right click on "Source Files" and click Add -> New Item
Select "c++(cpp)" file from that list, set the name to "main" and press ok.
You will now have the main.cpp up, if not double click on the main.cpp in the Solution Explorer
The Code
First off we are going to tell c++ to include the "iostream" so type the following code
- Code: Select all
#include <iostream>
O.K so we've loaded the "iosteam" but what now ?
Lets save some time by adding this line :
- Code: Select all
using namespace std;
Now, "STD" means standard and puting in this code will save us some time later on, I will explain it when we get there
Lets do the main code :
- Code: Select all
int main()
{
cout << "Hello World" << endl;
return 0;
}
Now, normally before "cout" and "endl;" we would have to put "std::" before it but since we put a "Namespace" ealier c++ will then know where the "std::" has to go
The code is completed ! But we still have something to do :
Click on Debug -> Start without Debugging or press Ctrl+F5 for a shortcut
You should be promt with a window which nags about it not being compiled, just ignore it and click on yes, it will compile and a CMD window will open saying "Hello World" in
Enjoy coding your own programs



