• Advertisement
Sign in to follow this  

I just can't understand C++

This topic is 4248 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm aspiring to go to UNT and be in thier game design program but for some reason I try my hardest to learn C++ but it just doesn't seem to stick and my motivation for learning drops. Is there anyway that I can learn C++ without making it hard on my brain to comprehend on what my eyes are looking at? I've looked into a few C++ websites but they just don't seem to be helping me. as of now i'm still stuck on "Hello World". Should i be memorizing what I see or understanding what should be happening? Roger 17

Share this post


Link to post
Share on other sites
Advertisement
No need to memorize everything, as you can search help files for specific functions to use.

You MUST understand what is going on though.

Have you tried doing very simple text base adventure games?

Are there any specifics of C++ that you don't understand that we could help you with?

Cheers!

Eric

Share this post


Link to post
Share on other sites
I want to know the basics. I'm not really specific since i really haven't been able to learn anything yet. I haven't even set my foot in the water.how could i make something like a tetris clone or a text-based adventure?

Share this post


Link to post
Share on other sites
Do you know any other languages? Many (probably most) concepts that you learn in one language will carry over to any other, and it makes learning a second or third language much easier. C++ is one of the harder languages to learn as a first language, so perhaps you should try another one. Python is recommended often for this role, and Java or C# probably wouldn't be bad choices either.

Share this post


Link to post
Share on other sites
Well, for a text adventure game, when you'll have read enough about the language you should be able to come up with the structure by yourself. Its ok if its not perfect, as you'll find out with more practice how to solve problems more efficiently.

As for tetris, there's this post that might help.

Share this post


Link to post
Share on other sites
Even Visual Basic is good to learn (that's how I started)... and its pretty similar to C# so from VB you'll be able to switch easily to C#, then to C++ if you ever need to.

Share this post


Link to post
Share on other sites
Do you know where I can find a guide on Visual Basic?

Is it the same as Blitz Basic? because i remember have a book on that.

Share this post


Link to post
Share on other sites
I've self-taught myself by looking at MILLIONS of tutorials and Websites, some books but i need too. Even today its hard for me to figure something out, but i eventually do, and these forums are a huge help. Just stick in there and keep throwing the ball until you make a basket, keep doing it and you'll eventually get better. What i did, and still do is download somebody elses program and play with the variables and add things the way they did, you know, just play around with everything and see what happens, i actually think thats the best way to learn, coz you can always look at something they've coded and compare it to some other code and see what the difference is, and yet being able to understand how it works. It can get very frustrating at times, but i cant say that there was one time that i got stuck and never found it out. I always find crap out when i stick on it and look for answers.

After looking at something for so long, you automatically memorize it, well i should say that for the most part you will. Repetition will help you so dont give up and keep looking and asking questions. I promise you'll get it....

Share this post


Link to post
Share on other sites
My suggestion is simply to sit down, look at a book (get one from the library is good if you can't afford to buy one), learn some of the very basics, go on your computer, go over it a couple times (like actualy programming the examples and such), and them move on. Go back to what you know sometimes to refresh your memory. It takes times. To get proficient with a languge it sometimes takes a year to two years.

Another good suggestion is to start with a simpeler languge (such as Java and C#), but I've seen others have already mentioned that.

Share this post


Link to post
Share on other sites
Gamedev is also currently in the throws of its own c++ workshop, which is a great resource for beginning c++.

Check out the forum here.

Share this post


Link to post
Share on other sites
I'm going to have to agree with everyone here. For the past... let's call it a while, cause it shames me to admit how long, I've been doing my darndest to teach myself how to program, starting with C++. For a long time, I just couldn't remember things, so to do even the most rudimentary of operations I would refer back to my books and tutorials (still am to this date to try and figure out how to do my binary file operations that I want). I'm by absolutely no means even close to a "decent" C++ programmer at this point, but I did something interesting recently.

I picked up a book about coding games in Python, Ruby and Lua, aptly titled Game Programming in Python, Ruby and Lua [Premier Press, Tom Gutschmidt w/ editting by Andre LaMothe] and something magical happened... I was reading the section teaching me how to draw graphics and whatnot in Python, and suddenly things started clicking. I understood what the author was doing in Python based on everything I had read about C++, even if I had not grasped how to implement it myself. So far (I'm still working my way through the book) it seems that every new thing I read about for Python makes things I was trying to wrap my head around in C++ make all the more sense. I can see how they work inherently.

Sorry if I come off as somewhat dumbstruck by the marvel of it all, but I am. I'm not sure I would necessarily recommend Python over C++, as the two languages are quite dissimilar and there are large differences in how certain structures and procedures are called and used in code, but I can definitely attest that learning one language will make the subsequent languages you try to learn easier. As such, Python may be a good thing to look into.

Best of luck, something to chew on,

Vopisk

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I suggest learning Python. Then you will learn the basic programming concepts which will help you understand C++

Share this post


Link to post
Share on other sites
Quote:
Original post by Vopisk
I picked up a book about coding games in Python, Ruby and Lua, aptly titled Game Programming in Python, Ruby and Lua [Premier Press, Tom Gutschmidt w/ editting by Andre LaMothe] and something magical happened... I was reading the section teaching me how to draw graphics and whatnot in Python, and suddenly things started clicking. I understood what the author was doing in Python based on everything I had read about C++, even if I had not grasped how to implement it myself. So far (I'm still working my way through the book) it seems that every new thing I read about for Python makes things I was trying to wrap my head around in C++ make all the more sense. I can see how they work inherently.


Well, first, I'll just say, I'd personally avoid anything written/edited by LaMothe. But that's just me. :)
Other than that, yep, that's pretty much how "it" happens. You just keep reading, tackling the problem from different angles (maybe by reading different books/tutorials, or in your case, by reading about a different language entirely) and sooner or later, it'll all start to click into place.
Can take a while for that to really happen, but it's hard to really program until you get this understanding. (For me, at least. Some people seem perfectly able to just copy code from tutorials, but I want to understand what I'm doing too)

Anyway, there's one very good point here. You've clearly illustrated why people shouldn't be so hung up on C++. There are plenty of other languages, and what you learn in one language *will* carry over and help you in other languages. Learning Python is a good start to learning C++, and vice versa.
If you find C++ hard going, look at another, easier language instead. That's not "giving up", it's just trying to learn.

Share this post


Link to post
Share on other sites
Yea, as other people have said a book will probably be your best bet. Go to the store and look around at them, check the "Who is this book for" section, to see if its for an absolute beginer, and look through the book to see if it has alot of code examples, some books will spend pages and pages on a concept, and it's really easiest to understand to see it at work (and with saying that, it helps if you type in all the examples by hand and understand what you are typing while typeing it). And don't worry to much about if you aren't fully getting it, just keep reading and eventualy it will all fit togather, and if you get to far in and still aren't getting the basics then just ask on these forums, or ask someone who knows programing.


And you could learn another language first, but it isn't impossible to learn c++ as your first language, if you do pick another language then you should concentrate on a language that will be usefull for other things you like to do, if your just learning it to get to c++ it might be a bit harder to learn then just jumping into c++. For example if you want to do alot of simple windows apps then C# or visual basic might be your best choice, if you want to make web pages the php or C# will be helpful (both of which are very similar to c++).

Share this post


Link to post
Share on other sites
Quote:
Original post by Spoonbender
Well, first, I'll just say, I'd personally avoid anything written/edited by LaMothe. But that's just me. :)


I am sorry if i am being dense, but your coment regarding LaMothe is not the first one i have seen, there are a few things like that on several other forums. In no spirit to start a flame war, just really curious, why do you think that? i mean, isnt the guy suposed to be some kind of guru, and has written a lot of game programming books and has some hardware projects too. So, could you elavorate?

Thanks in advance.

Luis R. Rojas

Share this post


Link to post
Share on other sites
Well, you wrote you're stuck with standard "hello word" program, right?
I can tell you something about how i started learning c++. I just made hello word program basing on a tutorial and then started playing wirh it. For example: I've changed the text printed to screen and added some more "cout" commands.
Then i tried to add a variable printed inside text, then i tried making manual input of this variable, then i read tutorial about fuctions and tried to apply them somehow and so on. Then after some time i suddenly came to conclusion: "Hey! i can handle functions, structures, pointers and classes pretty well!" I haven't even spotted when that happened.

So if i can give you a piece of advice: don't rush, and if you see a piece of code you don't understand don't stare and think for hours but change something in it and see what happens.

Share this post


Link to post
Share on other sites
Quote:
Original post by lrojas
Quote:
Original post by Spoonbender
Well, first, I'll just say, I'd personally avoid anything written/edited by LaMothe. But that's just me. :)


I am sorry if i am being dense, but your coment regarding LaMothe is not the first one i have seen, there are a few things like that on several other forums. In no spirit to start a flame war, just really curious, why do you think that? i mean, isnt the guy suposed to be some kind of guru, and has written a lot of game programming books and has some hardware projects too. So, could you elavorate?

Thanks in advance.

Luis R. Rojas


LaMothe is a fine writer, but a poor programmer. Or at least he's an antiquated programmer. His books are entertaining, and he explains things clearly and concisely for beginners. Unfortunately, what his books discuss are mostly things that no modern programmer has to do for themselves (loading bitmaps, manually blitting them and swapping buffers). Further, the actual code examples are fraught with error, poor style, outright lies, and software design resembling a train wreck.

They are the pinnacle of cash grab publishing.

Share this post


Link to post
Share on other sites
I had that same problem and i decided to go into a simpler language so i went to C
so i can understand C procedual to go to C++ OOP.

Share this post


Link to post
Share on other sites
Quote:
Original post by Vopisk
I'm going to have to agree with everyone here. For the past... let's call it a while, cause it shames me to admit how long, I've been doing my darndest to teach myself how to program, starting with C++. For a long time, I just couldn't remember things, so to do even the most rudimentary of operations I would refer back to my books and tutorials (still am to this date to try and figure out how to do my binary file operations that I want). I'm by absolutely no means even close to a "decent" C++ programmer at this point, but I did something interesting recently.

I picked up a book about coding games in Python, Ruby and Lua, aptly titled Game Programming in Python, Ruby and Lua [Premier Press, Tom Gutschmidt w/ editting by Andre LaMothe] and something magical happened... I was reading the section teaching me how to draw graphics and whatnot in Python, and suddenly things started clicking. I understood what the author was doing in Python based on everything I had read about C++, even if I had not grasped how to implement it myself. So far (I'm still working my way through the book) it seems that every new thing I read about for Python makes things I was trying to wrap my head around in C++ make all the more sense. I can see how they work inherently.

Sorry if I come off as somewhat dumbstruck by the marvel of it all, but I am. I'm not sure I would necessarily recommend Python over C++, as the two languages are quite dissimilar and there are large differences in how certain structures and procedures are called and used in code, but I can definitely attest that learning one language will make the subsequent languages you try to learn easier. As such, Python may be a good thing to look into.

Best of luck, something to chew on,

Vopisk

That's my only complaint about LaMothe's book (WGP for Dummies). He throws code and doesn't explain where it came from or why/how it does what it does. Thank goodness for GameDev [smile]

Share this post


Link to post
Share on other sites
Look at it this way...once you know C++, the process is done.

As languages go (and this is from someone who started with Visual Basic--NOT ADVISED AT ALL, by the way), C++ is surprisingly clean. It's flexible (in most cases) and reasonably "clean." As for learning it, there's the effective, easy way to do it, and then there's the hard way.

Easy way:

Go here. Get Thinking in C++, Volume One and its accompanying Volume Two. Print it out if you can (highly recommended, it makes it a lot easier to internalize--at least, I think so). And read Volume One.

And read it again.

And read it again.

Bruce Eckel may very well be the best author I've ever seen when it comes to explaining C++. It's a far, far easier way to learn C++ than to go looking at websites that may or may not have a clue.

Share this post


Link to post
Share on other sites
Heh, I have TIC++ Vol. 1 & 2 sitting in big, 3" binders on my bookshelf. Excellent books, especially considering the price ;)

C++ Demystified and Beginning C++ Game Programming, I cannot recommend, I have seen more in depth, direct and helpful tutorials on the internet.

Sam's Teach Yourself C++ in 21 Days is not horrible, but is fraught with lots of code and general errors and typos that can leave you frustrated for days on end when you realize the problem was a typo by the person who is supposedly teaching you the proper way to do things. I.E. Most people's dislike for Andre LaMothe.

Share this post


Link to post
Share on other sites
actually, I had started reading the Sams book once when i found it in our library(very poor amount of books) and it helped me undertand until i just stopped thinking i don't know what had happened.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement