[Guide] Learning Basic C++ menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    7itanium's Avatar Banned
    Reputation
    706
    Join Date
    Jul 2008
    Posts
    1,838
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [Guide] Learning Basic C++

    This is a simple introduction to c++, It wont teach you much but can be used to see if this is the programming lanuage you want to learn. The first requirement for learning c++ is a good bunch of spare time C++ ain't easy, so you have to use some time to learn it.


    1. IDE
    The first thing you should get is a IDE (Integrated development eviroment). IDE is a software where you will write your code a compile it. I use Bloodshed Dev C++. I finde this IDEgreat, and it contains everything a newbee needs.

    DOWNLOAD LINK-
    Bloodshed Software - Dev-C++

    Download and install


    1. Get started
    The next thing you should do is to make a folder on one of your harddrives to save all your Projects and c++ files. I use c:\cpp . Thats the best place to save your files (my opinion). They will then be easy to access. Now go to your start menue and open cmd.exe (run>cmd.exe). When the black windows opens the type : «cd c:\cpp» (replace c:\cpp with your c++ folder) then leave it open.



    3.Your first program
    This program is usless, but its allways fun makeing something. Open Dev c++ click on New>Sourc File.
    Now type the following:

    Code:
    /*Pratice_Sample1
     this program wil print «I love C++!»
     */
     
    
      #include <iostream>
     
    
      using namespace std;
     int main ()
     {
     cout <<"I love C++!";
     
    
      return 0;
     }
    Save as Practise_sample1.cpp
    then press compile (ctrl+F9)


    go to the blackbox from step2 and type: practise_sample1.exe. The program will then run!
    Congratulations! You have just made your first c++ program, Now it's time to explain some things


    The first 3 lines of the code is just a comment, the compiler ignores it, so it wont affect your program.
    To make a comment you can use the command «//» or «/* /» in Dev C++ comment will appear in blue text. «//» is used for comments thats just uses 1 line «/* */» is used when the comments uses more than one line.


    The comment don't need to first in the program and can be placed before or after a statement.
    Example:
    cout <<"I love C++!"; //this is a comment!




    The next line of code is really importaint for your program, If you thought the word «include»
    is there becausee it's inclueds something, then your right. The «#include <iostream>» includes the iostream libary, the compiler then includes code from the «iostream» libary. the letters io in iostream refer to input-output, which is a computer term that describes how data is input into our programs and how we get information out of them. If we fail to include the iostream file in our program, we wouldn’t be able to display the words ‘I Love C++’ on our computer monitors.




    The next line contains a «{« It shows that here, the next section of code starts and all programs ends with a «}» that shows that here the code ends.


    Now for the main thing in this program, «cout <<"I love C++!";» this is where we tell the compiler what to print out. «cout<<» tells the compiler that it's output, «cout<<» The .exe will the print the text thats between the quotes «"I love C++!"». Each line of code has to be ended with « ; «.


    return 0; tells the program that now this section of code is over an the program will now quit. If you have several different of code section in the main c++ file then don't it's not needed. It is only needed at end of programs or after errors.


    I have not included 2 lines of code in the little description of c++.


    using namespace sdt;
    and
    int main ()


    The reason for not including this is that they arn't worth focusing on at start, it may get a bit too conffusing then, thats something you will need later. This little guid will as said not teach you c++, but gives some pictures of how it verry basacly works. C++ is prettey hard to learn and is going to take a long time to master, for many people it may be best to start with easier languages as maybe Java, I would stay clear of VB since it's theaches lot's of bad habits.


    But anyways, the next step of learning more c++ would be to get a book about it. Learning c++ from webased torturials ain't going to bring you far, buy a book or download a .pdf.


    Personaly I have read «Learning to program with c++» by John Smiley, I find this book to start at a basic level thats good for learning it, It also dosen't requires any experience from programing from before!



    Hope this helps some of the newby programmers!

    [Guide] Learning Basic C++
  2. #2
    Mirror's Avatar Contributor
    Reputation
    259
    Join Date
    Nov 2006
    Posts
    2,602
    Thanks G/R
    0/0
    Trade Feedback
    2 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Funny how nobody even looks at the good posts. That could help you get more accounts, but all the leechers are at the giveaway section /tear.
    THIS SIGNATURE IS IN VIALOATION OF SITE RULES, PLEASE FIX ME!
    -Fault

  3. #3
    ugly_rocket's Avatar Active Member
    Reputation
    17
    Join Date
    Nov 2007
    Posts
    77
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How learning to print"I love C++" will get me more accounts?

  4. #4
    join's Avatar Member
    Reputation
    26
    Join Date
    Dec 2007
    Posts
    153
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dammit! really nie guide, but, it dosen´t print it for me..


  5. #5
    ugly_rocket's Avatar Active Member
    Reputation
    17
    Join Date
    Nov 2007
    Posts
    77
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    btw i can't seem to know which compiler to download when i click the link i feel im lost

  6. #6
    Viitapiru's Avatar Member
    Reputation
    2
    Join Date
    Jan 2007
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by ugly_rocket View Post
    How learning to print"I love C++" will get me more accounts?
    You know it might feel useless, but when you've learned enough, you can create lot of things that can be used to gain great profit. Tho, that learning is not gonna happen in short period. Those guides that are titled like "Learn C++ in 20 days" are ridiculous.

    SourceForge.net: Downloading ...

    Go here for direct download to Dev-C++ 5.0 ide. You might find confused at first. Don't give up, if you are wondering something or having problems, ask for help

    Good luck.

  7. #7
    mrclean128's Avatar Member
    Reputation
    1
    Join Date
    Oct 2008
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the guide (and download links for C++) it was usefull and i can stop my mum saying that i only play games on the computer.
    you should make a full learn c++ guide as you go into depth with what everything does.

  8. #8
    Viitapiru's Avatar Member
    Reputation
    2
    Join Date
    Jan 2007
    Posts
    18
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by mrclean128 View Post
    Thanks for the guide (and download links for C++) it was usefull and i can stop my mum saying that i only play games on the computer.
    you should make a full learn c++ guide as you go into depth with what everything does.
    Of my experiences it doesn't matter what you do in computer, it's still "playing all of the time", thats what your mum thinks ^^

    you should make a full learn c++ guide as you go into depth with what everything does.
    C++ programming contains so huge category of various things that are, in my opinion, impossible to list in one guide. And nowadays since there are already so many good guides, most people are writing them becouse the good learning they gain while writing things, searching for information etc. Well, thats what I think.

  9. #9
    KRYPTON88's Avatar Banned
    Reputation
    97
    Join Date
    Oct 2008
    Posts
    180
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow thanks! Im trying to learn C++ and start programming Some addons or applications for WoW, Not sure were to start hopefully this program will get me on the right track eh?

  10. #10
    Bird Is The Word's Avatar Contributor
    Reputation
    147
    Join Date
    Aug 2007
    Posts
    410
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do I make it run longer, so it actually stay up on my screen. It just flickers for me.
    Last edited by Bird Is The Word; 11-14-2008 at 06:08 PM.

























  11. #11
    Draza's Avatar Member
    Reputation
    14
    Join Date
    Nov 2008
    Posts
    17
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First "C++" so i'm going to make it "hello world" nice guide
    ---------------------------------------------------------

    Originally Posted by Bird Is The Word View Post
    How do I make it run longer, so it actually stay up on my screen. It just flickers for me.

    Hope you read the steps

    1. Get started
    The next thing you should do is to make a folder on one of your harddrives to save all your Projects and c++ files. I use c:\cpp . Thats the best place to save your files (my opinion). They will then be easy to access. Now go to your start menue and open cmd.exe (run>cmd.exe). When the black windows opens the type : «cd c:\cpp» (replace c:\cpp with your c++ folder) then leave it open.

    |
    |
    when you have done thet type "program.exe" into CMD it will print your message
    -----------------
    Will it help me if i know VB08 programing?
    Last edited by Draza; 12-04-2008 at 11:32 AM.

  12. #12
    bence0701's Avatar Member
    Reputation
    1
    Join Date
    Jun 2008
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi!

    That's also a solution but, if you make a program and eg. give it to your friend you can't just say open it from command prompt :P

    else you can do it this way:

    Code:
    #include <iostream>
    #include <conio.h>
    
    int main(int argc, char *argz)
    {
    
    using std::cout;
    using std::endl;
    
    cout << "Some of your text here." << endl;
    
    _getch();
    
    return 0;
    
    
    }
    the _getch() command will stop the program until you press a key.
    for example you can do it this way to... ( 'cause _getch() will not display any message)

    Code:
    ...
    
    cout << "Please press enter!";
    _getch();
    That was all

    Good Programming!

  13. #13
    tomit12's Avatar Active Member
    Reputation
    34
    Join Date
    Jun 2006
    Posts
    198
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Question:

    I've been through most of several C++ books, but there is something that never seems to come up in any of them...

    "#include <iostream>" - I understand what #include does, as well as iostream, but here is what I've never figured out - how do you find what needs to be included? Is it more or less just a matter of flipping through references and web pages to find the appropriate includes for the commands you want to use?

  14. #14
    dekz's Avatar Member
    Reputation
    5
    Join Date
    Jan 2008
    Posts
    37
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by tomit12 View Post
    Question:

    I've been through most of several C++ books, but there is something that never seems to come up in any of them...

    "#include <iostream>" - I understand what #include does, as well as iostream, but here is what I've never figured out - how do you find what needs to be included? Is it more or less just a matter of flipping through references and web pages to find the appropriate includes for the commands you want to use?
    Well man think about it, for example am I going to use an ADT in this class only? such as a list? maybe I should #include <list> in the header, else it really won't compile. Its pretty much saying, "yo preprocessor, act as if I defined how a list works just above this source code, so you know how to use it".

    Hope that clears it up a little.

  15. #15
    Powerking89670's Avatar Member
    Reputation
    3
    Join Date
    Jun 2009
    Posts
    7
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by tomit12 View Post
    Question:

    I've been through most of several C++ books, but there is something that never seems to come up in any of them...

    "#include <iostream>" - I understand what #include does, as well as iostream, but here is what I've never figured out - how do you find what needs to be included? Is it more or less just a matter of flipping through references and web pages to find the appropriate includes for the commands you want to use?
    Yes, very much so. You'll find that after a while of writing applications though that you start to kinda know what includes apply depending on what you're doing. And if you miss one the compiler will yell at you .

Page 1 of 2 12 LastLast

Similar Threads

  1. How To: Learn Basic AutoIt
    By Glynbeard in forum Community Chat
    Replies: 25
    Last Post: 04-07-2011, 07:19 AM
  2. [Selfmade] Danamians tanking guide! Learn to be a proffesional paladin tank.
    By R 3 A L 1 T Y in forum World of Warcraft Guides
    Replies: 21
    Last Post: 12-02-2008, 06:27 PM
  3. (easy macro guide) Learn Mangos Gm Spells (if your a gm)
    By grayfm in forum WoW EMU Guides & Tutorials
    Replies: 1
    Last Post: 08-02-2008, 01:09 AM
  4. [GUIDE] Glider Basics
    By LiquidShizzles in forum World of Warcraft Guides
    Replies: 5
    Last Post: 05-11-2008, 12:39 PM
  5. Guide to basic addons
    By Kiloboban in forum WoW UI, Macros and Talent Specs
    Replies: 7
    Last Post: 11-19-2007, 11:26 PM
All times are GMT -5. The time now is 09:46 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