#1 Members - Reputation: 251
Posted 23 November 2012 - 07:27 PM
For example, I understand arrays and stuff, but I guess I don't understand how I would use it in a program? I am more just curious if this is normal to understand what I am learning does, I just don't know how to use it yet.
Hopefully this makes since, if not i'll try to clarify it a bit more. Thank's in advance!
#2 Members - Reputation: 5877
Posted 23 November 2012 - 07:43 PM
I can give you examples of situations where arrays are useful:
* To represent a chess board, you can use an array of 64 small integers indicating what's in each square.
* A map in a RTS game is usually a grid of squares, which is represented as an array.
* A polynomial in one variable is an array of coefficients.
In C++ you very often will use std::vector instead of arrays, because they are more flexible (you can change their size dynamically).
#4 Moderators - Reputation: 7768
Posted 24 November 2012 - 12:19 AM
Especially when you are starting out and inexperienced, it can be very difficult to understand the "why" of certain things, or the bigger-picture concepts of how to use those things. Give it time and keep practicing, and you'll start seeing areas where things "itch" - you can't quite say why, but you know there has to be a better way to do things. Pay attention to those itches - they are usually a sign that you are ready to learn a new concept.
[Work - ArenaNet] [Epoch Language] [Scribblings] [Journal - peek into my shattered mind]
#5 Members - Reputation: 3503
Posted 24 November 2012 - 12:21 AM
Keep reading and practicing from lots of sources, and it will come in time!
As for arrays, they are a way to store data.
Most of programming involves only 2 things. Allocating memory for data, and operating on that data.
int a; will allocate space for 1 integer(whole number). You can assign a value to a and operate on it.
int a[10]; will allocate space for 10 integers [0-9].
A deck of cards is an array of 52 Card objects;
struct Card
{
int suit;
int value;
}
const int DeckSize = 52;
Card Deck[DeckSize];
You can use a loop, such as this, to iterate over the array
for (int i = 0; i < DeckSize; ++i)
{
Deck[i].Suit = whatever;
Deck[i].Value = whatever;
}
#6 Staff - Reputation: 8925
Posted 24 November 2012 - 12:31 AM
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#7 Crossbones+ - Reputation: 743
Posted 24 November 2012 - 01:11 AM
"The only thing stopping you from what you want in the future is what you want right now." - Zig Ziglar
#8 Members - Reputation: 251
Posted 24 November 2012 - 02:34 AM
This is entirely normal, and something you will experience again and again throughout your programming career as you discover new concepts over time.
Especially when you are starting out and inexperienced, it can be very difficult to understand the "why" of certain things, or the bigger-picture concepts of how to use those things. Give it time and keep practicing, and you'll start seeing areas where things "itch" - you can't quite say why, but you know there has to be a better way to do things. Pay attention to those itches - they are usually a sign that you are ready to learn a new concept.
Ok thank you. I assumed it was normal, but I just wanted to make sure. Thanks for the posts guys makes me feel a bit better as I was kinda going "crap I don't know how I would use this yet xD".
Anyway I am learning from C++ sams teach yourself one hour a day and these youtube videos: http://thenewboston.org/list.php?cat=16
I really like the way he explains everything, makes it all make since and really like him, glad I found out about those videos before I started learning as he's a great teacher
#9 Staff - Reputation: 8925
Posted 24 November 2012 - 02:58 AM
- Jason Astle-Adams.
From my blog: 20 ways to advertise your game | What next? Intermediate to advanced C++
How to make games WITHOUT programming | 4 reasons you aren't a successful indie developer
#10 Crossbones+ - Reputation: 743
Posted 24 November 2012 - 11:19 AM
e-book: http://newdata.box.sk/bx/c/
uni pages: here
Hope this helps, these taught me a lot back when I was starting out with C++.
EDIT: The uni pages ARE videos, if there was any uncertainty.
Edited by MrJoshL, 24 November 2012 - 11:20 AM.
"The only thing stopping you from what you want in the future is what you want right now." - Zig Ziglar
#11 Members - Reputation: 452
Posted 24 November 2012 - 01:49 PM
The other most obvious thing is practice coding and think and be aware. It is okay to rest your brain of course. But what I am going to say is programming is cumulative. What you do not know might prevent you from solving a problem. Ask people for help but also show what you have done already so people can actually see what you know and do not. The sky is the limit. Always seen patterns in code and how these programming structure varies. Stay active on forums and persevere with the problem that is troubling. Struggle with the problem and eventually you will be friends with the problem. As soon as you solve it, I guarantee you will say " that was not so bad after all." =]
Good luck and happy coding.
Edited by warnexus, 24 November 2012 - 01:56 PM.
#12 Members - Reputation: 538
Posted 24 November 2012 - 03:05 PM
Well my question in general is, is it normal for me not to understand how to like make a program with it even though I know how to make one, and understand what it is, just not how to use it.
Sometimes it depends on what you are learning from, several popular C++ books are flooded with useful information but are described in such a ermm 'mathematical text book' way where you are often left wondering "so I know how to do this but where would I use it?", I would probably say "[Wrox] Beginning C++ by Ivan Horton" and "Programming principles C++ by Bjarne Stroustrup" are the only book I have came across that arent like this for C++, typically Apress / Wrox try to give ideas on where to use things.
Ofc then theres pointers which only made sense to me at least from delegates / ref / out in C#.
But to answer your question, yes it is normal but sometimes its not you its the book you are reading from






