c++ tutorial section

Discussion in 'Public Game Developers Forum' started by inferi22, May 28, 2009.

  1. inferi22

    inferi22 Well-Known Member

    Jan 11, 2009
    1,099
    1
    0
    hoping some of you will contribute(mr croc)
     
  2. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    ok, ill do what i can.

    im on a pc, never used a mac yet. first youll need a compiler, i use MS visual studio which wont make a difference with what im saying other than 1 or 2 things if youre on a mac, i think there will be GNU or GCC for the mac, making projects and compiling will differ, perhaps someone else could chime in with what you would need to do different.

    the compiler is a handy program which takes our easy to use high level language (c++) and breaks it down into data the pc can understand.

    so assuming your on pc and have MS visual studio up and running.

    file->new->project and select win32 console application
    (this just means when you run, it runs on a pop up screen whilst windows is running)
    then when youve selected ok, another screen will pop up, select application settings, select empty project, and make sure console app is ticked
    right click on source files in solution explorer and select "add new item"
    select to add a new .cpp file

    now type in

    Code:
    #include <iostream>
    using namespace std;
    void main()
    {
    	//the following prints out "hello world" to screen
    	cout << "hello world" << endl;
    }
    then build and run. a pop up screen should come up saying "hello world"

    this is the hello world program for c++. getting to this stage is 1/2 the battle so after you or anyone else has gone through it ill go through exactly what the code means, then introduce the next thing which will build upon this program.

    if it helps much, you wont need to understand anything up to "void" for a long time, and anything which has // in front isnt code, its just comments.
     
  3. cool mr croc

    cool mr croc Active Member

    May 27, 2009
    41
    0
    0
    perhaps the best thing would be to go through some of those tutorials then post back here if you get stuck or would like more in depth info, or if you want the ame thing explained in a different way (that always helps me)

    my tip is bear in mind the whole point of c++ is to create your own optimal high level language, so youll end up with code like

    someObject.dothis->heyYou(turnOffTV)

    so when your stuck in a tutorial, think about how you can accomplish this style of personalised code.
     

Share This Page