[TuT] First Program in C++

Posts 1–10 of 10 · Page 1 of 1
[TuT] First Program in C++
Firstly, Get a Compiler, this is what takes the code and makes it into a program. There are a lot of compilers of there but I suggest VC++ 2010. The download can be found in the Crossfire source code section here!

This first program you will write is simple: Helloworld!
Open a new console application project in VC++ and go to: Add New Item > and add a (.cpp) file called main.cpp!

Once you are ready type this code down to write your first program:



Code:
#include <iostream>

int main()
{
	std::cout << "Hello World!" << std::endl;
	return 0;
}
Now to explain the coding:

BLUE = CODE
BLACK = EXPLANATION

Code:
#include <iostream> (Including the standard iostream file into your program)
Code:
int main()

int: is an integer number value. 
main(): defines that the main function is about to be stated
Code:
{
	std::cout << "Hello World!" << std::endl;
	return 0;
}
{ = start of code
} = end of code
std = standard
cout = console output
endl = endline
"TEXT" = When used with "cout" it is displayed on the computer screen
<< = These arrows show what will be placed on the screen (ie. std::cout << "Hello World!" This shows that "Hello World! will be displayed on the console window)
return 0; = Think of this as ending the main function and returning back to the program with no results (no exactly but close enough)

Therefore the Code:
std::cout << "Hello World!" << std::endl;

In English can be written as:
standard::console output << "Hello World!" << standard:: endline;
When executed the program looks like this:


Well what you just learned to do is code, although coding hacks arent that simple, everything is more complicated but everything basically revolves around this have fun coding

NOTE: I KNOW THERE ARE LOTS OF C++ TUTS HERE BUT THIS ONE TEACHES YOU HOW TO CODE THE MOST BASIC PROGRAM BUT STILL TEACHES YOU THE BASIC COMPONENTS THAT MOST C++ PROGRAMS HAVE!
C+P fail.
This was posted and stickied(I think) before.
I spent an hour typing this tut up so dont say i C+P it....
I took the pics i wrote the code all from my computer -.-"
gawd people recieve no credit for their work these days....
Man... I havnt done this in a while.
Basically I made this tut for choobs who whine about not having any hacks and they want people to code it for them... this is so they know its not that easy :P Actually it is pretty easy but it takes time.... and patience is what choobs dont have
But yea... old coders can refresh themselves with this too
can i use borland C++???


#include<stdio.h>
void main(void)
{
int a;
printf("Hello World");
scanf("%d",&a);

}

plz check .....
Quote Originally Posted by Hahaz View Post
Please post it here next time ^^
C++/C - MPGH - MultiPlayer Game Hacking
Ill make sure i do that next time... xD
im always in the cf section :P

Quote Originally Posted by genufuk View Post
can i use borland C++???


#include<stdio.h>
void main(void)
{
int a;
printf("Hello World");
scanf("%d",&a);

}

plz check .....
K imma try it when i get the time....
cuz im busy right now

Quote Originally Posted by superleggera01 View Post
fail...nuff said/
Gawd i already said that this is for the noobs -_-
Posts 1–10 of 10 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us