Ghana Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

C++ CODING FOR NEWBIES

Go down

 C++ CODING FOR NEWBIES Empty C++ CODING FOR NEWBIES

Post by The Boss 2014-07-15, 12:40 pm

To be a hacker you must learn how to develop your own programs else downloading others software will end you up been hacked.
To code a program you have to learn programming language. C , C++ , RUGBY , JAVA , PYTHON , DELPHI , VB.NET C# .... etc are all programming languages
Don't ask me which language is best for hacking it all depends on you how far you study the language. I started learning this Language a week ago i'm sharing so far what i have i learnt with you. So Today i will be teaching you the basics of C++.

DISCLAIMER:




What is C++
You came here to learn C++, right ! First before you start learning let me tell you what c++ is ,and when it was created.

C++ was created during the 1980's time ( To be Exact 1983) it was designed and developed by Bjarne Stroustrup. Well not exactly by him since many other communities and people helped him such as Bell Labs.

Bjarne Stroustrup was quite a Intelligent man of course considering he designed and created a whole language by him but of course he got this idea from C, Simula, Ada 83, ALGOL 68, CLU, ML. These Computer Languages were quite a demand at those times .

The problem was that the languages may have been at a demand at those times but these were very slow and clumsy when it was practical.
This allowed Bjarne to enhance the syntax to make it seem more human ( i mean like it would be easier to understand ).
Soon Bjarne asked help from many facilities to make so called c++ alive. After years the Language was ready to go.

This language was then made public. The language wasn't doing very well until Bjarne made a Book about C++ basics and Advanced until many programmers started to read c++ book until they absolutely loved it. This is a Simple background of C++.

Section 1.0 - Purpose in C++

C++ was a General purpose language. It has variety of features from making household applications to making global desktop applications. C++ was also made to be a bit hard because Bjarne thought that if anyone masters C++ they can earn more money than other programmers. This also a small percentage for its success.
In our World we still use that language. The biggest companies use this language also the Military use it to carry out Cyberwarfare attacks against other nations.

This shows the true power of C++.

Now lets get coding...
C++ Coding
Now we get to the part where we learn. Keep yourself concentrated.

Now first you need to setup a Compiler and IDE .
----------------------------------------------------------------------

What is a Compiler and a IDE ?

Okay a Compiler is a program which translates your code into machine language. It is a translator.

An IDE is a acronym for Integrated Development Environment. This allows you to get help when coding. IDE is a tool which help you design better applications some IDE's allow you to complete words.
A feature a IDE should have :
Refactoring facilities (Renaming affects dependencies/Extract Method/Extract interface etc.)
Intellisense (or any other code completion functionality)
Error checking (the IDE actually knows its symbols)
No setup hassle
Integrated compiler
Integrated debugger
Better navigation to and from references/declarations
Project templates / file templates
GUI builders
Can autogenerate boilerplate code
It's intuitive and can be used without knowing all the magic keys (hey, that's why GUIs became successfull in the first place)
-----------------------------------------------------------------------------

Anyway lets carry on...

Before you download a Compiler i will tell you what most coders tend to use:

Visual Studio 2012

Code Blocks. << Preferred one. is what i'm using now.

Dev C++


Anyway after you set your IDE and Compiler up lets begin.

Basics - Lesson 1 - Hello World

Now open a Project if using Code Blocks or Microsoft and open a Source File if using Dev c++.

Now lets get to coding:

We will make a Hello World Program which is the tradition of coders to code a Hello world programs.
The hello world Program:
#include<iostream>
using namespace std;
int main()
{
cout<<"Hello World ";
cin.get();
}

Now lets analyze it. The #include<iostream> is called a header file this is which has some of the key words we use such as cout<<"";
and cin.get(). Imagine that has a package in which we build stuff with.

Then There is using namespace std; this is a way to stop us putting std:: before every thing which belongs to iostream file.
To allow you to understand this if we take out using namespace std;
we will get a error to cure this error without putting:
using namespace std;

is to put std:: before every cout<< and cin.get();
to test this run this :

#include<iostream>
int main()
{
std::cout<<"Hello World";
std::cin.get();
}

Okay now you get the point of using namespace std;
Lets continue to analyze this, Now we see int main() this is a the entry pint of the program i mean this is where the compiler reads data from.

So without int main() our program will become a piece of error code. We must always include this int main() in. The int main() is something called a thread but we will not cover threads in this tutorial since threads is a advanced part of c++.
Now since we understand how to write a simple applications which show a messages to the user lets continue with this tutorial.

Lesson 2 - Commenting

Well this should be the most easiest lesson in this tutorial because this is about commenting.
What is commenting?
Commenting is a way to explain your program to your self or others around you we simply do this by putting // then writing any thing after it. This tells the compiler to ignore this line since this is a comment. This is cumbersome so use /* and then */ to block off everything between as a comment.
like this :
#include<iostream>
#include<stdlib.h>
using namespace std;
int main()
{
cout<<"Hello World"; // This is a Comment

system("PAUSE");
return.0;
/*
Hi ....Blah blah blah bala


dsafadsfsadf
*/
}

easy eh!
It took me 2 hours to make this so please tell me if it helped you at the bottom :]
You can also Google for more tuts.
HAPPY CODING.


E-BOOK DOWNLOAD [You must be registered and logged in to see this link.]
The Boss
The Boss
Admin
Admin

Posts : 481
Join date : 2014-07-14

https://ghana.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum