What exactly can I use C++ for?

Pages: 12
If I'm going to learn it, I need to know what it's for :O! And, are there any way a 12 year old can learn this? Thanks!
Hi Jello, I am a 22 year old who was really into computers when I was your age. Sadly, I never followed up my desire to really learn C++ when I looked into it at that age. If you want to get into programming, C++ is definitely an important language to learn.

C++ is used to create computer programs! Anything from art applications, music players and even video games. Yes, many video games have been made in C++. Keep in mind though, just like you wouldn't be able to write a book in Spanish after taking a few classes, you won't be making any serious video games right off the bat. Programming, like many skills, takes time. This is something I'm sure many people your age (including me at that age) sadly learn every day.

There are many tutorials out there to teach you C++. The problem is, C++ is not exactly an easy language to learn. You can definitely give it a try, but I'm pretty sure unless you have worked with some other programming language before, it will probably be over your head. I am not trying to talk down to you, but at the age of 12 C++ was a bit over my head. Who knows, you may be the smartest 12 year old ever. Search around google or this site for tutorials. The best way to learn is to read, read, read and program, program, program. Read the forums on this site and see what other people are trying to do. Think of something you want to program, and see if you can figure out how to do it. Start simple and take more chances, this is the way to become a good programmer.

The only way I could really see you getting into C++ at your age would be to find someone who could walk you through the basics and really break it down to you in simple terms. A lot of the people that write programming tutorials seem to forget that not everyone reading is a genius or completely familiar with a lot of programming terms. Either that, or buy a copy of C++ for Dummies.

Hope that helps, if you have any more questions or need me to explain anything, just repost here and I'll answer. Unfortunately, I can't walk you through actually learning C++. Check the forums for that. Anything else, I'll do my best to answer.

Don't be discouraged! Learn programming any way you can! You are never too young to start! In fact, I wish I had started seriously programming at your age and stuck with it. I have a lot of time to make up for! :D

Good luck!
closed account (z05DSL3A)
http://www.cplusplus.com/doc/tutorial/
Thanks! You really inspired me!
The problem is, C++ is not exactly an easy language to learn. You can definitely give it a try, but I'm pretty sure unless you have worked with some other programming language before, it will probably be over your head.


I learned HTML code at 8, and I know Lua script pretty good. HTML isn't much like C++, but Lua is actually quite similar! I know it will be hard to learn, but I'll try hard!
Are you sure you are 12... I only say this because as a 12 year old, I never used the word inspired. Maybe I was just slow!
Different people have different aptitudes. I learned HTML and Fortran at around the age of 12.

Sadly, I never really used any of the fortran. I was more interested in playing Doom on my new 486 DX2 (i miss DOS a lot). So now that I am in my 20s I went back to programming and I am having to learn everything all over again...
Yes I'm 12, lol xD!
You're twelve?? Heh-heh, welcome to the club. I started learning C++ when I was eleven, just finished last year, now I'm thirteen.

Yea, there's a way for you to learn it. Simply go out and buy a book, or if you are a good self-motivator, simply use this site. After you get done with your first book/site, move onto some advanced topics with google and such.

closed account (2EwbqMoL)
You're twelve?? Heh-heh, welcome to the club. I started learning C++ when I was eleven, just finished last year, now I'm thirteen.


uhh is learning c++ something you can ever really "finish" per say? I mean being a programmer in any language (especially lower level more complex languages like c++) is all about solving new problems with code, and theres always new libraries to learn about, and the ability to extend the language yourself...

Your probably a great programmer, I have no doubts about your capabilities, its just that from my point of view I cant understand the mindset that anyone is ever totally done learning a language...

and I started learning stuff like this at 11 too, but C++ didnt come until later (I was at least 13 when I started that I think... but it might have been earlier I have a bad memory haha)
Last edited on
jello:

its good that you have chose this kind of passion in your early age...
you'll probably be good on this when the time comes..
spiroth: I mean basic C++ stuff like the language syntax and all.
Again like I said, I didn't mean to insult you in anyway!!!

On a better note, Welcome to the club. I am 18 and have been actively programming, whether C++ or Java or PHP, for about 4 years now, WOW its been that long feel like only yesterday I was a freshman taking a computer science class just so I got them out of the way. Now I can't stay away!!! The ironic part 4 years and I still know nothing!!!

Anyway,

The best way to learn, in my personal opinion and situation, is to ask questions. When I don't get something, i first try here at cplusplus.com, If I find nothing, I look to Google, if all else fails then I post a thread. In the end I find myself 2 hours later on something completely diffrent with the answer to my original question and much more!

Stay self motivated, and diligent. I highly recommended the book Sams teach yourself C++ in 21 days v6. It's a great beginners book. Take it slow, run each example and test diffrent things. C++ can be used for so many things, and you will find learning it will be fun, and frustrating!!! I wish I started at your age!

I wish I started at your age!

Don't we all wish?
You're blessed, make good use of it, 'for what you sow in sweat and tears shall you reap in joy and laughter'. From my part of the world it was a privilege to use a PC. Things are changing thank God.
Take the advice above (kacko's) to heart for its sound. But it dose not have to be all work make it fun.
Thanks for the tips and motivation everyone! The only problem is, I don't know WHERE I use it. I downloaded the Bloodshed C++ program, I can type things in, but there is no "output". I just type it in, and nothing happens. The text changes color, but that's about it. Can anyone perhaps explain where I can use it? Thanks in advance ^_^!
Bloodshed C++ is just an IDE (Integrated development environment). It can help you write code (like you sayed with the colors, but much more) but to convert to an executable program you need a compiler. Bloodshed works with MinGW that you can find at http://www.mingw.org/
If you already have the compiler then try to find a Run button to execute your program. (F9 or Execute->Run)
Dev-C++ (from Bloodshed) comes with the MinGW compiler as far as I know (unless you downloaded a version without it). You should be able to click the Compile and Run button near the top left to run your code. Compiling turns the code into an executable file (a file that can be run).

Also, since no one mentioned this, the best advice I can give you when starting to learn a language (and most people will agree) is to constantly try to make little programs to use the concept you just learned. If you try and just read an entire book and then go and program, you will find that you really didn't understand much (even though at the time you were reading it all made sense). It is best to learn a concept or two (no more than that) and then go play with it. You will find that even playing with one concept you will run into problems. From overcoming those problems in practice you will completely solidify each concept as you go.
If you want to take an intermediate step, and have a practical "use" for what you are learning, I suggest getting a copy of WarCraft3 and start making some triggers for custom maps. Since the WC3 expansion, The Frozen Throne, came out, you can now build triggers in a language called JASS, which consists of functions and logic similar to C, but without many of the advanced features. The great thing about all this is that you have a great motivator to learning: the more code you create, the more gameplay you have to do to test your work! Ahh, the burden of bugtesting!

Here's a trigger from one of my maps:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
function Trig_Slayer_Turns_Func010A takes nothing returns nothing
    call SetUnitOwner( GetEnumUnit(), Player(10), true )
endfunction

function Trig_Slayer_Turns_Func032Func001Func001C takes nothing returns boolean
    if ( not ( GetPlayerController(Player(9)) == MAP_CONTROL_USER ) ) then
        return false
    endif
    if ( not ( GetPlayerSlotState(Player(9)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return false
    endif
    return true
endfunction

function Trig_Slayer_Turns_Func032Func001Func002C takes nothing returns boolean
    if ( not ( GetPlayerController(Player(11)) == MAP_CONTROL_USER ) ) then
        return false
    endif
    if ( not ( GetPlayerSlotState(Player(11)) == PLAYER_SLOT_STATE_PLAYING ) ) then
        return false
    endif
    return true
endfunction

function Trig_Slayer_Turns_Func032Func001C takes nothing returns boolean
    if ( Trig_Slayer_Turns_Func032Func001Func001C() ) then
        return true
    endif
    if ( Trig_Slayer_Turns_Func032Func001Func002C() ) then
        return true
    endif
    return false
endfunction

function Trig_Slayer_Turns_Func032C takes nothing returns boolean
    if ( not Trig_Slayer_Turns_Func032Func001C() ) then
        return false
    endif
    return true
endfunction

function Trig_Slayer_Turns_Actions takes nothing returns nothing

 local integer PlayerNumber = udg_TurningPlayerNumber
 local location DeathPoint = Location(GetStoredRealBJ("X", ( "SlayerDeathPoint" + I2S(PlayerNumber) ), GetLastCreatedGameCacheBJ()), GetStoredRealBJ("Y", ( "SlayerDeathPoint" + I2S(PlayerNumber) ), GetLastCreatedGameCacheBJ()))
 local integer a = 1
 local group TempGroup
    call CreateItemLoc( 'I002', DeathPoint )

    call ForceRemovePlayerSimple( Player(PlayerNumber - 1), udg_SlayerPlayers )

    if ( GetPlayerSlotState(Player(PlayerNumber - 1)) == PLAYER_SLOT_STATE_PLAYING ) then
        call ForceAddPlayerSimple( Player(PlayerNumber - 1), udg_AllPresentZombiePlayers )
    endif

    loop
        exitwhen a > 10
        set udg_DeathSplatPlayerId = PlayerNumber
        call ConditionalTriggerExecute( gg_trg_Death_Splat )
        call PolledWait( 0.03 )
        set a = a + 1
    endloop

    call RemoveUnit( udg_DummySlayer[PlayerNumber] )

    call PlaySoundBJ( gg_snd_HowlOfTerror )

    set TempGroup = GetUnitsOfPlayerAndTypeId(Player(PlayerNumber - 1), 'nglm')

    call ForGroupBJ( TempGroup, function Trig_Slayer_Turns_Func010A )

    call SetForceAllianceStateBJ( bj_FORCE_PLAYER[PlayerNumber - 1], udg_SlayerPlayers, bj_ALLIANCE_UNALLIED )
    call SetForceAllianceStateBJ( bj_FORCE_PLAYER[PlayerNumber - 1], bj_FORCE_PLAYER[PLAYER_NEUTRAL_PASSIVE], bj_ALLIANCE_UNALLIED )
    call SetForceAllianceStateBJ( bj_FORCE_PLAYER[PlayerNumber - 1], udg_AllPresentZombiePlayers, bj_ALLIANCE_ALLIED_VISION )
    call SetForceAllianceStateBJ( bj_FORCE_PLAYER[PlayerNumber - 1], udg_AllAbsentZombiePlayers, bj_ALLIANCE_ALLIED_VISION )
    call SetForceAllianceStateBJ( bj_FORCE_PLAYER[PlayerNumber - 1], udg_Players10and12, bj_ALLIANCE_ALLIED_VISION )
    call SetForceAllianceStateBJ( udg_SlayerPlayers, bj_FORCE_PLAYER[PlayerNumber - 1], bj_ALLIANCE_UNALLIED )
    call SetForceAllianceStateBJ( udg_AllPresentZombiePlayers, bj_FORCE_PLAYER[PlayerNumber - 1], bj_ALLIANCE_ALLIED_VISION )
    call SetForceAllianceStateBJ( udg_AllAbsentZombiePlayers, bj_FORCE_PLAYER[PlayerNumber - 1], bj_ALLIANCE_ALLIED_VISION )
    call SetForceAllianceStateBJ( udg_Players10and12, bj_FORCE_PLAYER[PlayerNumber - 1], bj_ALLIANCE_ALLIED_VISION )
    call SetForceAllianceStateBJ( bj_FORCE_PLAYER[10], bj_FORCE_PLAYER[PlayerNumber - 1], bj_ALLIANCE_UNALLIED )

    call CreateUnitAtLoc( Player(PlayerNumber - 1), 'n006', DeathPoint, udg_SlayerFacing[PlayerNumber] )

    call FlushStoredMissionBJ( ( "SlayerDeathPoint" + I2S(PlayerNumber) ), GetLastCreatedGameCacheBJ() )

    call DisplayTextToForce( GetPlayersAll(), "OH SHIT!" )

    call ConditionalTriggerExecute( gg_trg_Infested_MB )

    call TriggerSleepAction( 1.00 )

    call DisplayTextToForce( GetPlayersAll(), ( GetPlayerName(Player(PlayerNumber - 1)) + " HAS TURNED INTO A ZOMBIE!" ) )

    call SetPlayerName( Player(PlayerNumber - 1), ( udg_PlayerNames[PlayerNumber] + " (Zombie)" ) )

    call ConditionalTriggerExecute( gg_trg_Set_AI_Units )

    if ( Trig_Slayer_Turns_Func032C() ) then
    else
        call ConditionalTriggerExecute( gg_trg_Set_Zombie_Ownership )
    endif

    set DeathPoint = null
    set TempGroup = null

endfunction

//===========================================================================
function InitTrig_Slayer_Turns takes nothing returns nothing
    set gg_trg_Slayer_Turns = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Slayer_Turns, function Trig_Slayer_Turns_Actions )
endfunction
He is 12 remember. I think that may be a bit much for now, but it could be something for him to keep in mind.
I don't think age really has much to do with it these days. Im 28 and I look at that and see ummm nothing I can understand hehe. If you have the drive to do it I say jump on board and give it a try. I just started myself. I am confused more than not. Just stick with it and enjoy yourself 8)
Well not all WC3 triggers have to be that large and complicated. lol Actually, there is a GUI interface for making triggers. You can stick with that for a while until you get the hang of it, then move over to JASS when you feel ready. That's another reason why I see it as a great transition platform.

Here is another one of my triggers, but this one is in the easier to understand GUI form.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Reincarnation
    Events
        Unit - A unit Uses an item
    Conditions
        (Unit-type of (Triggering unit)) Equal to Special Ops Unit
        (Item-type of (Item being manipulated)) Equal to Ankh of Slavation
    Actions
        Set SlayerIsReincarnating[(Player number of (Owner of (Triggering unit)))] = True
        Wait 3.00 game-time seconds
        Unit - Move (Triggering unit) instantly to RescuePoint
        Camera - Pan camera for (Owner of (Triggering unit)) to RescuePoint over 0.00 seconds
        Wait 4.01 game-time seconds
        Unit - Set life of (Triggering unit) to 1.00
        Set SlayerIsReincarnating[(Player number of (Owner of (Triggering unit)))] = False
        Set TempPoints[1] = (Position of (Triggering unit))
        Special Effect - Create a special effect at TempPoints[1] using Abilities\Spells\Human\Resurrect\ResurrectCaster.mdl
        Custom script:   call RemoveLocation( udg_TempPoints[1] )
        Special Effect - Destroy (Last created special effect)

See? That's not so bad.
Pages: 12