Jump to content

  • Log In with Google      Sign In   
  • Create Account


Is this normal?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
11 replies to this topic

#1 blade55555   Members   -  Reputation: 251

Like
1Likes
Like

Posted 23 November 2012 - 07:27 PM

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!

Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 10820

Like
1Likes
Like

Posted 23 November 2012 - 07:43 PM

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

#3 blade55555   Members   -  Reputation: 251

Like
0Likes
Like

Posted 24 November 2012 - 12:00 AM

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.

#4 ApochPiQ   Moderators   -  Reputation: 12431

Like
12Likes
Like

Posted 24 November 2012 - 12:19 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.

#5 MrDaaark   Members   -  Reputation: 3535

Like
2Likes
Like

Posted 24 November 2012 - 12:21 AM

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[i].Suit = whatever;
	Deck[i].Value = whatever;
}


#6 jbadams   Senior Staff   -  Reputation: 14937

Like
2Likes
Like

Posted 24 November 2012 - 12:31 AM

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. Posted Image

#7 Toothpix   Crossbones+   -  Reputation: 810

Like
0Likes
Like

Posted 24 November 2012 - 01:11 AM

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.


#8 blade55555   Members   -  Reputation: 251

Like
0Likes
Like

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 :P.

#9 jbadams   Senior Staff   -  Reputation: 14937

Like
3Likes
Like

Posted 24 November 2012 - 02:58 AM

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.

#10 Toothpix   Crossbones+   -  Reputation: 810

Like
0Likes
Like

Posted 24 November 2012 - 11:19 AM

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.

Edited by MrJoshL, 24 November 2012 - 11:20 AM.

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


#11 warnexus   Prime Members   -  Reputation: 1250

Like
1Likes
Like

Posted 24 November 2012 - 01:49 PM

I do agree, it's perfectly normal since you are just starting out. Having worked with the Java language and some C++ for 2 years I like to think about programming as methologically thinking about the programming concepts and how these ideas and concepts connect and relate to things you seen before(ie: video games, word processors like microsoft word). I also think if you make a connection with what you learning now in programming with how the programmers make the video game(like world map, collision detection, game logic) it will make much more sense.

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 Strix_Overflow   Prime Members   -  Reputation: 760

Like
2Likes
Like

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS