Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial [CHAPTER 1]C++ Crash Course - Getting Started
#1
Information 
Soo.....
If you want to learn the basics of C++ you are in the right place.
But keep in mind that this is a short intense course!

Requirements:
-IDE(prefered Microsoft Visual C++ 2010 (Express(free)))
-A brain Wink

Keep in mind that this is a crash course. Won't explain it the long way and it can be hard to understand some time.

-----------------------------------------------------------------------------------------------

1. Getting know with the Integrated Development Environment
If you are launching Microsoft Visual C++ (will say MSVC++ instead) the first time you are getting this screen:
[Image: StartPage.png]

To create a project file for our purpose you have to File -> New -> Project...
Here you have to Search for "Win32 Console Appplication". Also you can name the Project in this Screen.
[Image: FirstProject.png]

After that an Application Wizard pops up. Press Next > and check the box for "Empty project" !!!

Congratulation you just created your first project. But it doesn't have any Files in it.
Let's add some then Wink
[Image: FirstSource.png]
We'll add a C++ File so select it and name it what you want. I'll call it main.

Let's create our first programm!
Code:
#include <iostream>
using namespace std;


int main()
{
    //Print in console
    cout<<"Hello ItsMods.com\n";
    return 0;
}

This programm is just printing "Hello ItsMods.com" into the console.
Why does we need to much code to do this?
First you have to know that lines that are beginning with // are comments. So you can write something after a // and it will be ignored by the compiler
also you can write comments over X lines with /* */ like this:
Code:
//Single line comment

/* Comment
Block
8924wgfeu9g
q34rfgovheaosrgh
*/

So comments are clear now. Next special character is the # in the first line.
# signals the compiler that something has to be done in this case #include the compiler is adding a file into this file. "iostream" is a file that comes with MSVC++.

Now int main()
It is a function that returns an integer value. EVERY PROGRAMM BEGINS TO START AT THE main-function.
return 0; is saying that in this line the function will return the integer value "0".

Function "cout":
cout stands for ©onsole (out). It is printing something on the console. To print soemthing you have to write the operator << before it.(Why? Just do it for now. Operator comes at a later chapter). The Character-String "Hello ItsMods.com\n" was printed in this program.
You can write somthing like this:
Code:
cout << "Test, Test 1.2.3...\n";
or
Code:
cout << "Test," << "Test " << "1.2.3...\n";
Both will do the same

But what was this "\n" doing in the programm?
This Strings are called "Escape-Sequence". These are special strings that are recognized by the function cout.
A table can be found at the german Wikipedia(couldn't find the english one):
http://de.wikipedia.org/wiki/Escape-Sequenz

\n stans for newline which is equivalent to the return-key on your Keyboard.

Soo now you have an IDE, Project and a sourcefile. But it isn't still a programm. You have to Compile and Link it.
With MSVC++ it is easy to do that. Just press at the Green Triangle on the top bar.
Yes. The Window is appearing and disappearing again. Thats normal. The Program has done his job and is quitting. To prevent that you can write
Code:
cin.get();
before
Code:
return 0;
We are discussing the normal usage of this function later.

Next to the Green Triangle there is a Dropdownmenue.
You can select between Debug, Release and configuration manager. The last item you can forget Wink
Debug and Release...
Generally you want to keep it at Debug. It will help you when you are debugging /finding a bug in your programm. You'll need it 100% at some time because no programm is bugfree.
If you are ready with your programm and want to share it/sell it you want to build a Release build. The compiler is optimizing your code so your programm can run at the maximum speed.


-----------------------------------------------
~End of Chapter 1

Yeah. you wanted a complete basic C++ Tutorial here is the beginning.
Of course most of you guys knew the before.


- Ich1994
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#2
(01-03-2013, 23:46)Ich1994 Wrote: A table can be found at the german Wikipedia(couldn't find the english one):
http://de.wikipedia.org/wiki/Escape-Sequenz

http://en.wikipedia.org/wiki/Escape_sequence

Protip: Click on English on Wikipedia to get to the English page.

Edit: Disregard, you wanted the table.

Edit 2:
English Wikipedia with Table.
http://en.wikipedia.org/wiki/Escape_sequences_in_C

(Google Escape Sequence in C and you find hundreds of pages having these)
Reply

#3
Lightbulb 
Its obviously gonna be a short and incomplete course like dozens of other on similar forums. So instead, make a full reference on how to start, where to get materials, tutorial sites, video tutorials, download stuff etc., something that will be useful for a pure beginner. Don't get me wrong but this kind of tutorials are like cooking receipts, where you "learn" how rather then why.
Reply

#4
This http://www.youtube.com/playlist?list=PL1D10C030FDCE7CE0
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#5
(01-04-2013, 14:32)House Wrote: Its obviously gonna be a short and incomplete course like dozens of other on similar forums. So instead, make a full reference on how to start, where to get materials, tutorial sites, video tutorials, download stuff etc., something that will be useful for a pure beginner. Don't get me wrong but this kind of tutorials are like cooking receipts, where you "learn" how rather then why.

Thats what they wanted over here...
http://www.itsmods.com/forum/Thread-Help...orial.html
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply

#6
Quote:1. Getting know with the Integrated Development Environment

Sorry but I can't bother starting to read a tutorial when the first thing I see is bad English. If I misunderstand a lot of things due to a grammar mistake, it's a waste of time.
YouTube 1:Azumikkel- Modding
YouTube 2:DerpShark- Gaming Entertainment
Website:Jensby.me
Contact: im[at]jensby.me
Reply

#7
(01-04-2013, 15:06)AZUMIKKEL Wrote:
Quote:1. Getting know with the Integrated Development Environment

Sorry but I can't bother starting to read a tutorial when the first thing I see is bad English. If I misunderstand a lot of things due to a grammar mistake, it's a waste of time.

Just say if you don't understand something. Nobody is perfect and i still don't know how to write that sentence.

So general Question: Should i skip the basics?
[Image: compiling.png][Image: aLKA8og_460sa.gif]
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Help cmdlist, dvarlist server crash Nerus 17 12,010 11-09-2013, 23:54
Last Post: Nerus
  Making a harrier crash into the map? akillj 6 4,983 06-09-2013, 05:57
Last Post: akillj
Its My Birthday! Happy birthday, Crash! Party Bot 0 1,687 06-08-2013, 00:00
Last Post: Party Bot
Brick [Release] Health on HUD (no crash :D) xtreme2010 3 6,238 04-21-2013, 00:20
Last Post: CHRISLUVMSR
  MDUMP CRASH ? HOW TO FIX Raja2k11 14 8,708 04-20-2013, 05:24
Last Post: yokai134
Information [Tutorial] [CHAPTER 2]C++ Crash Course - Variables Ich1994 0 1,960 02-04-2013, 18:47
Last Post: Ich1994
Sad Help - HUD element Crash Server ((( xtreme2010 4 3,895 01-20-2013, 09:22
Last Post: archit
  Help Server Crash Pyro2142 1 2,259 06-28-2012, 03:41
Last Post: DidUknowiPwn
  Crash After First Map Rotation worldclass 6 3,996 06-08-2012, 21:50
Last Post: SuperNovaAO
  Crash After First Map Rotation worldclass 6 3,998 06-08-2012, 20:30
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.