1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

I am interested in C/C++

Discussion in 'Programming & Webmastering' started by gopal, Sep 22, 2012.

?

Do you think i can learn C/C++?

  1. You have the talent to learn it!

    10.0%
  2. Yes, you can

    40.0%
  3. Maybe, not sure

    25.0%
  4. You? With C/C++ I think the sun is going to rise from west tomorrow(No never)

    25.0%
  1. gopal

    gopal

    Joined:
    Jun 25, 2012
    Messages:
    1,027 (1.55/day)
    Thanks Received:
    121
    Location:
    Patna, Bihar, India, Asia, Earth, Terron System, M
    Anyone know an good tutorial on it?
    I really want to learn it, also what software i am gonna need to do that.

    Reason for learning it:
    PCSX2 is an emulator that emulates PS2 Games on PC i really like it and i wanna help them by doing something with C/C++.
    I mostly intrusted in C/C++ because their software is mostly based on C/C++.

    So i want to learn it!
    I am looking for tutorials(if i can get Video tutorials then SUPERB), anyone know good tutorials?
  2. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    I would start with C and work your way to C++. I'm assuming you have enough underlying knowledge about how computers work at a low level to start learning C right off the bat.

    Maybe something like this would help?

    I'm not going to say that you can or can not learn how to program, writing code is the easy part. I think anyone can learn how to program but I'm not convinced that all people can program well or understand what other people have written.
  3. gopal

    gopal

    Joined:
    Jun 25, 2012
    Messages:
    1,027 (1.55/day)
    Thanks Received:
    121
    Location:
    Patna, Bihar, India, Asia, Earth, Terron System, M
    hmmm, C codes pretty much similar to .cns codes
  4. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    What's that? :confused:
  5. gopal

    gopal

    Joined:
    Jun 25, 2012
    Messages:
    1,027 (1.55/day)
    Thanks Received:
    121
    Location:
    Patna, Bihar, India, Asia, Earth, Terron System, M
    .cns is an component of M.U.G.E.N.
    What is MUGEN?
    Ans.- MUGEN is an game engine where you can customize EVERYTHING from Menus to stages to characters.
    .cns is an file which an MUGEN character needed it contains every action of its.
    An Example of how .cns looks
    Code:
    ;---------------------------------------------------------------------------
    ; Stand
    [Statedef 0]
    type = S
    physics = S
    sprpriority = 0
    
    [State 0, 1]
    type = ChangeAnim
    trigger1 = Anim != 0 && Anim != 5
    trigger2 = Anim = 5 && AnimTime = 0 ;Turn anim over
    value = 0
    
    [State 0, 2]
    type = VelSet
    trigger1 = Time = 0
    y = 0
    
    [State 0, 3] ;Stop moving if low velocity or 4 ticks pass
    type = VelSet
    trigger1 = abs(vel x) < Const(movement.stand.friction.threshold)
    trigger2 = Time = 4
    x = 0
    
    [State 0, 4] ;Are you dead?
    type = ChangeState
    trigger1 = !alive
    value = 5050
    ctrl = 0
    
    ;---------------------------------------------------------------------------
    ; Stand to Crouch
    [Statedef 10]
    type    = C
    physics = C
    anim = 10
    
    [State 10, 1]
    type = VelMul
    trigger1 = Time = 0
    x = .75
    
    [State 10, 2] ;Stop moving if low velocity
    type = VelSet
    trigger1 = abs(vel x) < Const(movement.crouch.friction.threshold)
    x = 0
    
    [State 10, 3]
    type = ChangeState
    trigger1 = AnimTime = 0
    value = 11
    
    ;---------------------------------------------------------------------------
    ; Crouching
    [Statedef 11]
    type    = C
    physics = C
    anim = 11
    sprpriority = 0
    
    [State 11, 1] ;Change from turning animation
    type = ChangeAnim
    trigger1 = Anim = 6 && AnimTime = 0
    value = 11
    
    [State 11, 2] ;Stop moving if low velocity
    type = VelSet
    trigger1 = abs(vel x) < Const(movement.crouch.friction.threshold)
    x = 0
    
    ;---------------------------------------------------------------------------
    ; Crouch to Stand
    [Statedef 12]
    type    = S
    physics = S
    anim = 12
    
    [State 12, 1]
    type = ChangeState
    trigger1 = AnimTime = 0
    value = 0
  6. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    Not quite. You have a lot more control of the system, the syntax is vastly different, variables are strongly typed, and you have memory pointers for accessing spots in memory dynamically. Also C doesn't work that way either, so other than both looking like some form of code (C is compiled and this most likely isn't as well,) I see no similarities with the example you provided.

    Instead of trying to say it is like something (which it is very clearly not, sorry) I would just try to learn C and see how it goes.
  7. gopal

    gopal

    Joined:
    Jun 25, 2012
    Messages:
    1,027 (1.55/day)
    Thanks Received:
    121
    Location:
    Patna, Bihar, India, Asia, Earth, Terron System, M
    yeah, will try to learn it When i Translate(This) I am very busy so i can't do that now
    Last edited: Sep 22, 2012
  8. rascal27 New Member

    Joined:
    Sep 24, 2012
    Messages:
    5 (0.01/day)
    Thanks Received:
    0
    C and C++ is best thing to learn because all embedded codings are basically c...
  9. DanTheBanjoman Señor Moderator

    Joined:
    May 20, 2004
    Messages:
    10,553 (2.92/day)
    Thanks Received:
    1,383
    You can't just learn some basic C and expect to be able to contribute to a complex project like PCSX2.
    Aquinus says thanks.
  10. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    +1: Correct! I'm willing to bet you the majority of those developers know more than just C, but how to develop, how to work in a team, and I'm willing to bet they have guidelines to code looks the same. If you really want to be able to work on complex projects like that you need a lot of experience and you need to start from the beginning.
  11. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Joined:
    Feb 6, 2007
    Messages:
    13,881 (5.28/day)
    Thanks Received:
    5,610
    Location:
    Cheeseland (Wisconsin, USA)
    Not to mention that you would need an intimate understanding of the hardware at it's lowest level in order to write a software emulator for it, but hey !! A guy has to have goals !!
  12. Frick

    Frick Fishfaced Nincompoop

    Joined:
    Feb 27, 2006
    Messages:
    10,245 (3.45/day)
    Thanks Received:
    2,018
    AlienIsGOD says thanks.
  13. 3870x2

    3870x2

    Joined:
    Feb 26, 2008
    Messages:
    4,875 (2.17/day)
    Thanks Received:
    689
    Location:
    Joplin, Mo
    as others may have already pointed out, once you look at the big picture of what is actually required, you will feel very overwhelmed. If you are just now learning, it will be a very long time before you will be able to contribute. Learning c++ is barely scratching the surface.

    Some may disagree, but c++ has made c obsolete, unless you are maintaining older code, or have specific reasons for it. C is much closer to the ground level of machine language, and is very time consuming.
  14. Frick

    Frick Fishfaced Nincompoop

    Joined:
    Feb 27, 2006
    Messages:
    10,245 (3.45/day)
    Thanks Received:
    2,018
    I have some microcontrollers here that use C. ;)
  15. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    A good reason to learn C. Being able to program embedded devices is a useful skill.
  16. MxPhenom 216

    MxPhenom 216 Corsair Fanboy

    Joined:
    Aug 31, 2010
    Messages:
    8,979 (6.77/day)
    Thanks Received:
    1,749
    Learn C#. Its basically the child of C and C++.
  17. eidairaman1

    eidairaman1

    Joined:
    Jul 2, 2007
    Messages:
    11,579 (4.66/day)
    Thanks Received:
    1,267
  18. Aleksander

    Joined:
    Dec 2, 2009
    Messages:
    3,252 (2.04/day)
    Thanks Received:
    304
    If you want to help them, study for 6 years and you are ready to help.
    So if you are a true time waster learn c++ only to help them.
  19. eidairaman1

    eidairaman1

    Joined:
    Jul 2, 2007
    Messages:
    11,579 (4.66/day)
    Thanks Received:
    1,267
    Aye- Code Warrior Comes to mind (Talk about buggy in XP when I was in HighSchool 9+ Years ago)
  20. Kreij

    Kreij Senior Monkey Moderator Staff Member

    Joined:
    Feb 6, 2007
    Messages:
    13,881 (5.28/day)
    Thanks Received:
    5,610
    Location:
    Cheeseland (Wisconsin, USA)
    If you are programming for hardware C# is not your best choice. You would have to circumvent a lot of the checks and balances that C# imposes, so you might as well just code in C or C++.

    If you really want to dive into the hardware level, forget all the sissy intermediate and higher level languages and jump into assembly language. :D
    eidairaman1 and Aquinus say thanks.
  21. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    Yes! Then you start getting stuff that looks like this:

    Code:
    	org     $2000
    	lds     #$2000  ; Initialize the stack.
    	ldaa    #16              ; just for testing, replace with buttons
    	staa    cnt2            ; ditto
    
    	ldaa	#0
    	staa	strpt
    	staa	incount
    	
    	jsr SETPASSWD
    
    	jsr CHKPASSWD
    
    lp1:	jsr GETKEY
    	ldab KEY
    	ldx incount
    	stab str1,x
    	inx
    	stx incount
    	jsr LCDOUT
    	jmp lp1
    	end
    There is actually a lot more there, I just don't feel like cleaning up all the assembly to make it even slightly readable. :eek:
    Edit: This is also from an earlier save, so this example wouldn't actually be complete. It's an example of what you have to do though.

    Like ldaa = Load Accumulator A (data register a)
    staa = Store accumulator a
    ldab = Store accumulator ab, which actually are data registers a and b to form 1 16-bit register instead of two 8-bit registers. (HCS12 can do both 8 and 16 bit math), but both memory address registers are 16-bit (x and y) So...
    stx = store x
    ldx = load x

    of course each of these has operands,
    Each of these loads and stores take a memory address and as with any micro-controller or micro-processor, there are at least a couple different addressing modes.
    then you have branching!

    jsr = jump to subroutine
    It jumps to the memory address in the first operand and it pushes the current IC (instruction counter register) to the stack and if the stack wasn't set to a spot in memory (lds) the processor will throw a fault code and halt.

    ...but with C, you don't have to worry about any of this, because the C compiler does it for you!
    Last edited: Sep 25, 2012
  22. gopal

    gopal

    Joined:
    Jun 25, 2012
    Messages:
    1,027 (1.55/day)
    Thanks Received:
    121
    Location:
    Patna, Bihar, India, Asia, Earth, Terron System, M
    this turned out difficult then i thought, maybe going to take about 5 yrs to learn :D
  23. 3870x2

    3870x2

    Joined:
    Feb 26, 2008
    Messages:
    4,875 (2.17/day)
    Thanks Received:
    689
    Location:
    Joplin, Mo
    Collectively, this is what everyone is saying.

    I would recommend learning it. I get a great amount of joy and satisfaction, even if the project is trivial.
    hellrazor and Aquinus say thanks.
  24. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    5,561 (6.86/day)
    Thanks Received:
    1,752
    Location:
    Concord, NH
    +1: There is something to be said for creating something and making it work. I wouldn't do this for a living if I didn't feel this way. :D
  25. TheMailMan78

    TheMailMan78 Banstick Dummy

    Joined:
    Jun 3, 2007
    Messages:
    20,635 (8.21/day)
    Thanks Received:
    7,244
    I tried messing around with C+ a few months back with the encouragement of Kreij. I didn't even know what the terms meant to even start. I needed a day one schooling for this stuff. Not "How do you compile" but "What is it that am I compiling and what IS compiling". lol

    Even the tutorials to me were like "WTF am I READING?!" Aerospace technology is WAY more simple then this stuff.

    Maybe I'm just to old to learn this kinda stuff. If your going for it at 13 years old gopal, don't let any of these people on a tech forum stop you. Learn it while you are young and stick with it through school. THEN go to school for it. Epic pay days can be had this way. I made a mistake long ago listening to people on career choices. IF I had stuck with what I enjoyed I would be working for Boeing or McDonnell Douglas right now.....like everyone else I went to school with lol.......but NOOOOOO I had to be different and pursue art.

    EDIT: Also stay away from drugs and goth girls. Another mistake I made.
    Last edited: Sep 25, 2012

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page