Is this normal?

Started by
10 comments, last by Dynamo_Maestro 11 years, 5 months ago
Hi so I am learning C++ and I am understanding what I am learning, in terms I know what they do, but I don't know how to apply them in a setting.

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!
Advertisement
There is no good answer to your general question. All the features of the language have been added because there was a need for them.

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).
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.
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.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

I would like to tell you that all this stuff will come to you in time. There will be a point where it will sink in and you will get it. But you haven't told us how you are learning C++? There are many ways to learn C++, not all of them are equal. Hopefully your learning source assumes you don't know how to program at all? Books that teach specific languages sometimes target people who are already familiar with programming in general, and aren't very good for complete beginners.

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.Suit = whatever;
Deck.Value = whatever;
}
Yes, in general it's perfectly normal that you might not immediately understand how to apply the concepts you're learning about. This will come with practice. smile.png

- Jason Astle-Adams

Many beginners ask this question, but you have to understand that a processor calculates basic instructions and branching logic. A GPU does the same thing but with floats and less branching and more parallelization of instructions. You have to understand that a programming language gives you maximum control over these basic instructions because it isn't software, it is a language, and you are controlling the instructions, albeit in a portable way (like in C/C++). For example, you may see a wall move, but the computer sees that as a model, made up of textures, texture coordinates (floats), texture bitmaps (array of values), and geometric world space coordinates (four floats for homogeneous coordinates). Also, if you are doing linear transforms, you will use matrices and/or quaternions for 3D games, and that is all using arrays, structs, and floats. My best advice is to pay attention and learn, as programming is useful in almost any field.

C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.


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 :P.
I haven't watched any of the videos myself, but have heard this from a lot of people I trust to know what they're talking about: just be aware that some of what thenewboston teaches isn't always best practice and might at times include some incorrect or incomplete information. If you're finding the videos helpful continue to use them, just don't take anything as gospel and be sure to continue using other sources as well. LearnCpp.com seems to be a pretty reliable resource if you're looking for another alternative.

- Jason Astle-Adams

Here is another helpful couple of resources. The first is an e-book, the second is a university page, and I would say that you could probably safely bet on the university page (Missouri S&T Computer Science Department) being 100% correct.

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.

C dominates the world of linear procedural computing, which won't advance. The future lies in MASSIVE parallelism.

This topic is closed to new replies.

Advertisement