Follow us on Twitter!
Hacking isn't just Computers & Exploits. It's a Philosophy. - Mr_Cheese
Wednesday, April 16, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 21
Guests Online: 17
Members Online: 4

Registered Members: 82811
Newest Member: IsaiahBowman
Latest Articles

Introduction to C++

Arrow Image A bit about C++



Hey there,
In this article I will be talking a bit about the C++ language..

So you ask what's C++,
Well is C++ was originated from the programming language C.
C++ is the enhanced version of C providing object-oriented programming.

Ok let's start.

To start up a project u need a C++ compiler there are quite a few c++ compilers out I myself use devC++ and Microsoft visual c++ 6 there are others such as borland and turboC++, for beginner I recommend VC++ 6.

To make comments within your C++ program u use the following syntax "//comment comes here"
Comments are usefull for good programming.

To start a project u use the line "#include <iostream>"

Iostream is a header file which is used for Input/output in the C++ programming language

Next we user "using namespace std;"
All the elements of the standard C++ library are declared within what is called a namespace

and finally "int main()"

So now we have the following

#include <iostream>
using namespace std;
int main()
{
}

That is the basic outlook of a program now let's start coding

We are gonna make a simple program to display the age of the use...

We will use the following two statements cin and cout

Cin = Consol input(get's what the user enters)
Cout = Consol output(display's what the user entered)

Ok so now we will want to declare a integer called age doing so we use the following syntax

int age = 0;

Now we have the integer age we will want to get what the user enters u use the following to get the data from what the user enters

cin >> age;

We use the ; to end a statement that we have made.

Now to display what the user enter we will use

cout << age << endl;

endl; = Ends the current line.

So the code would look as following

#include <iostream>
using namespace std;
int main()
{
int age = 0;
cout << "Please enter your age: "; //We want the user to enter his/hers age.
cin >> age; //Here we get what the user enters
cout >> "Your age is: " >> age >> endl;
return 0;
}

Ok so those are the basics on C++ and remeber when outputting a variable not to use the quotes or else it will just output what u entered as the variable name...

Thank you for taking your time and reading:)

- Nightfox

Comments

bl4ckc4ton May 15 2006 - 16:28:50
Im not an expert on C++ but iostream is for cout. its a header that makes cout more efficient.
revolt0163on May 15 2006 - 17:46:41
never explained: what a comment is about ; why we need to declare variables what return is/does if you want to do an introduction tutorial you should start with a simple hello world Wink
revolt0163on May 15 2006 - 17:58:47
never explained: what a comment is. about ";". why we need to declare variables. what return is/does. if you want to do an introduction tutorial you should start with a simple hello world. (sorry had to post again because the last one looked like shit
system_meltdownon May 15 2006 - 19:29:21
BORLAND SUCKS! Bloodshed Dev-C++ is better, it has a nice GUI
sponge1233on September 04 2006 - 23:25:58
Nice tutorial. Smile But line 8 of your code should have the arrows facing the opposite way for cout. Besides that, great work!:happy:
enforceron October 21 2006 - 19:48:53
if someone will start learning from such a poorly written article, he has no future in programming. you even got the cout wrong. whats good in someone who knows how to do a hello world proggie but doesnt know what every line does.
T-Metal-Risenon October 23 2006 - 06:34:26
What the fuck, this is the biggest piece of shit article ever. You only tell half-truths about everything, one example is "std::endl; <== ends the line". My fucking dog could have told you that by GUESSING. std::endl; prints out a newline character and than flushes the output buffer. Learn the fucking language before you try and teach others. kkthxbai
Post Comment

Sorry.

You must have completed the challenge Basic 1 and have 100 points or more, to be able to post.