[C++] Tutorials: #1 menu

User Tag List

Results 1 to 12 of 12
  1. #1
    sabbathitman's Avatar Member
    Reputation
    40
    Join Date
    May 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [C++] Tutorials: #1

    Getting Started:

    By the end of this tutorial you would have learnt how to output text,

    Intro:

    I've always been sort of dissapointed with RaGEZONE's Coders section. It's always been full of VB-wh0res and web developers (although, WDs aren't bad). I've always wanted RaGEZONE's coders section to become more Desktop-programming orientated (Not inc VB). Although I think only 5-10% of this section consists of this.
    So I'm here to provide people with a series of C++ tutorials (How many, is depending on the comments I recive: Good/Bad).
    So here's Lesson #1:

    The first you're going to need to begin your C++ adventure is a descent compiler. There are many compilers about... some of which, barely pass as a compiler.

    Although there are many C/C++ compilers about, there are two in mind that are considered the best (better userability/more user-friendly, better compiler and better debugger).
    Personally I'd say Microsoft's Visual C++ Compiler and IDE has a better debugger, I feel Bloodshed's Dev-C++ IDE and Compiler is more user-friendly, and easier to navigate.
    But don't take my word for it, try it out for yourself:


    (Windows Compatible)
    Microsoft Visual C++:
    Overview: Download details: Visual C++ 2005 Redistributable Package (x86)
    Download: http://www.microsoft.com/downloads/i...redist_x86.exe

    (Windows Compatible) (Reccomended)
    Bloodshed's Dev-C++:
    Overview: Bloodshed Software - Dev-C++
    Download: SourceForge.net: Downloading ...

    Other: (Reccomended by Daevius)
    Code :: Blocks:
    Download: SourceForge.net: Downloading ...

    Okay, so I'm going to be writing a tutorial as if you were using Dev-C++ v5.0, although if you have any other version of Dev-C++ or even a different compiler, the simple things like Compile and Run are pretty much simple.

    So, lesson #1 is going to be teaching you how to compile your first program, and explaining data types.
    So I'm going to need you to install the provided downloads given to you, install the programs and then double click the exe to launch the program.
    So after you have launched the program, you're going to want to create a console application (the next few tutorials we will be using console application).
    So go to File > New > Project... and then select Console Application, and name it 'MyProject' or anything you want (It's just a name), but it's best to keep a directory, for easy access and organisation. Once you've given a name to your project, make sure that 'C++ Project' is selected. Once you have done all of this, click 'Ok'.

    Now, you should have a window with the following code in it:

    Code:
    #include <cstdlib>#include <iostream>using namespace std;int main(int argc, char *argv[]){ system("PAUSE"); return EXIT_SUCCESS;}

    ...or some similar code.

    What I want you to do is highlight it all and delete, so your project is left empty.

    Okay, so after that's done, I want you to take a look at this code:

    Code:
    #include <iostream>using namespace std; int main(){cout << "Hello There RaGEZONE\n"; // Outputs the sentence "Hello There RaGEZONE") cin.get(); // Requests user to hit Enter key to end application }
    Anything familiar about the above code? If not, no worries at all This is the reason I'm here, to teach you what this means and how to use it

    That's start with #include <iostream>.
    #include <iostream> is something called a preprocessor directive that requests code from that header file to put into our application.
    By including a header file, it provides you with the use of certain functions, such as cout.


    The next line of code is: using namespace std;
    using namespace std; is similar to that of <iostream>. Basically, this line of code is something called a standard library. Using this line, it allows you to use certain functions such as cout. (See the similarities?). Also, notice the semi-colon ( ; ) on the end of the the line of code. This is apart of C++'s syntax and is used for most commands.



    Now the next line is int main ().
    This is the beginning of the main functions. It's where the C++ program's start their execution (depending on the location of the code).
    int is for when the fuction returns an integer.
    The braces ( { } ) bascially defines the beginning and the end of the execution.
    Everything after { is what will be executed, everything before } is what has been executed.

    Note: When I say "Executed" it basically means performed/done/run.


    cout << "Hello There RaGEZONE\n";
    Now what this is doing is outputting the phrase "Hello There RaGEZONE"
    Think of the statement cout as output.
    cout is declared in the iostream standard file within the std namespace, this is the reason why we needed to include that specific file and to declare that we were going to use this specific namespace earlier in our code. (Every line of code is done for a reason). The bracket things << are insertion indicators, indicating what our output is going to be.
    The \n means newline. What it does is seperate output on the screen, so it doesn't look disorganised:
    Example:

    Code:
    cout << "Hello Ragezone";cout << "I'm Awesome";
    This would output as:

    Quote:
    Originally Posted by Output
    Hello RagezoneI'm Awesome

    Now, if you wanted a space between Ragezone and I'm, you would have to make sure you left a space in one of them:

    Code:
    cout << "Hello Ragezone ";cout << "I'm Awesome";
    or

    Code:
    cout << "Hello Ragezone";cout << " I'm Awesome";
    Or if you wanted it to be one line of code:

    Code:
    cout << "Hello Ragezone\nI'm awesome";
    Output:

    Quote:
    Originally Posted by Output
    Hello Ragezone I'm awesome

    Note: Notice how the \n (newline) is ALWAYS within the double quotation marks? This is a Must!

    Note: C++ is a case-sensitive language, so everything has to be the way it's supposed to be:
    Cout = wrong
    cout = right

    //
    This is simply to mark line notes. They don't affect the application in anyway, they're only used for viewers of the code.
    /* this is
    a
    blocknote*/

    A blocknote is a... well, a note formatted as a block. This is used for full, descriptive explenations of a piece of code.

    cin.get();
    (Notice the ; ? It's been used throughout this application, remember what I said? It's used on functions).
    Without placing the cin.get(); , the application window will instantaneously open and close. By placing cin.get(); at the end (before the end bracket), it means the application needs the user to press enter for the application to close.

    After you have typed all of this code in, and know what everything is, try mesing about with the code a bit. Insert \n with new phrases. Learning C++ is all about exploring. I'm going to give you a guideline but you will have to explore solo a bit if you want to fully understand C++'s nature

    And for the end part:
    After you are happy with your codes, go to Execute > Compile & Run name it to whatever you want and there you have it! Your first C++ application.
    This is the end of C++ Tutorial #1
    I will be writing C++ Tutorial #2 Soon

    What will be in Tutorial #2?:

    You will be learning about data types, becoming more familiar with console applications and functions within. I will teach you how to use declare and define, how to manipulate integers and will result in teaching you on how to make a calculator

    C&C Would be greatly appreciateed

    Any questions about this tutorial or future tutorials are welcomed and will be answered ASAP

    Credits: Me...
    www.strangegaming.ucoz.com

    Use it if you got other stuff for any other game

    Sorry if i cant advertise Websites XD

    [C++] Tutorials: #1
  2. #2
    Chris-h11's Avatar Contributor
    Reputation
    91
    Join Date
    Jun 2007
    Posts
    81
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Great tut
    +rep
    Last edited by Chris-h11; 09-08-2007 at 08:23 AM.

  3. #3
    sabbathitman's Avatar Member
    Reputation
    40
    Join Date
    May 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Thxs Hope it helps
    www.strangegaming.ucoz.com

    Use it if you got other stuff for any other game

    Sorry if i cant advertise Websites XD

  4. #4
    EcHoEs's Avatar lol why u mad
    Reputation
    374
    Join Date
    Sep 2006
    Posts
    1,647
    Thanks G/R
    3/1
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Great Any idea where could i find e-books for c++?
    +rep for this


  5. #5
    Free Hugs's Avatar Contributor
    Reputation
    116
    Join Date
    May 2007
    Posts
    425
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Awesomeness

    +rep
    MMOKings - The #1 safest place to buy WoW Gold

  6. #6
    sabbathitman's Avatar Member
    Reputation
    40
    Join Date
    May 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Thxs for rep
    www.strangegaming.ucoz.com

    Use it if you got other stuff for any other game

    Sorry if i cant advertise Websites XD

  7. #7
    sabbathitman's Avatar Member
    Reputation
    40
    Join Date
    May 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Omg Look A Bumb

  8. #8
    Herleybob's Avatar Contributor
    Reputation
    178
    Join Date
    Jul 2007
    Posts
    663
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    hey great guide, i used the Ascent source code to learn C++ or CSharp w/e it is, yah ive learned how to create new gm commands, cool.

    Nom Nom Nom :P

  9. #9
    sabbathitman's Avatar Member
    Reputation
    40
    Join Date
    May 2007
    Posts
    155
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Lol Nice What commands did ya make?
    www.strangegaming.ucoz.com

    Use it if you got other stuff for any other game

    Sorry if i cant advertise Websites XD

  10. #10
    Koest's Avatar Active Member
    Reputation
    37
    Join Date
    Sep 2007
    Posts
    200
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    Nice, hope I can learn something xD

  11. #11
    Le Froid's Avatar Contributor
    Reputation
    172
    Join Date
    Mar 2007
    Posts
    1,327
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: [C++] Tutorials: #1

    why was he banned? (only reason i care is for tut #2 :P)\

    edit:nvm copied off ragezone
    Last edited by Le Froid; 10-01-2007 at 12:08 AM.

  12. #12
    satanicmerlien's Avatar Member
    Reputation
    1
    Join Date
    Nov 2015
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    very nice its very good for guys who is not familiar with C++ and help them to become good dev ^_^ +rep

Similar Threads

  1. Exploting tutorial and top elwyn bugs. Video
    By kp3 in forum World of Warcraft Exploits
    Replies: 5
    Last Post: 09-17-2006, 10:53 PM
  2. Ontop of SW wall(first gate) 1.12 -pictures+video tutorial.
    By kp3 in forum World of Warcraft Exploits
    Replies: 15
    Last Post: 09-16-2006, 04:49 PM
  3. Full Old School Tutorial...
    By Gnaughty in forum World of Warcraft Exploration
    Replies: 11
    Last Post: 09-12-2006, 10:38 AM
  4. Game Hacking Tutorial!
    By lopolop in forum Community Chat
    Replies: 24
    Last Post: 06-29-2006, 08:39 AM
  5. Muling Tutorial
    By Matt in forum World of Warcraft Guides
    Replies: 0
    Last Post: 06-19-2006, 05:40 PM
All times are GMT -5. The time now is 09:45 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search