Begginers Questions

I've been trying to learn C++ and I can't seem to understand a lot of it. I mean I can write the code when I'm using a book to learn but I don't know how to practice very well. I'm not sure how i should approach it. I'm having problems knowing how to use certain things. For example, I've just read about enumerations and such, but I don't know how i'd practice it without copying what is in the book, or the Char type, I know how to give a value like, char x = 'x';. but i don't know how it would be used. What I guess i'm trying to say is that I'm a beginner that would really like some help know how to practice and how to understand things better. Thanks.
Think up an idea of a program to write, then write it, applying as much of what you learned as possible.
Ok, i'll give it a try. i'm not sure how to make a program out of somethings like Variables, enums, and constants.
Write a program that asks the user to enter two floating point numbers, then outputs their sum.
Declare a constant for PI equal to 3.14159. If the user enters the letter 'p' instead
of a number, use the the value of PI.

Read the input as a string using getline. First check if the string is length 1 and the first character
is a 'p'. If it isn't, then use the function atof() to convert the string to a double.

To do that, you'll need to use variables and constants.
Oh, Ok. Thanks for the help and ideas man. Your really Helpful. Thanks again.
when i get programming books, they usually are broken into chapters i read the first couple of chapters which go over basic syntax, maths and variables. then i start making small programs and playing with the syntax and slowly getting to know more and more. one of my first c++ projects was a calculator that ran in a console. very easy and extensible there are loads of things you can make.
Hi Christian, what resources are you using to learn? Based on your other post your drive is game programming correct? A good mindset to have is everything you learn, think about how a game might do it? For example, when you think of an int variable, how might you use it to store data? Maybe current player hit points? Variables, enums and constants are all about data, which is what drives all software. Just as an example you may have a very basic player class that looks like this:

1
2
3
4
5
6
7
8
9
10
11
class Player
{
public:
// all the different functions that might effect a player
// for example reducing or restoring the players hit points

private:
	int currentHealth;
	int maxHealth;
	string playerName;
};


Make any sense?
Maybe you should go for designing. The pay is almost the same and it's easier compared to programming.
Something I came across on another part of these forums - quite helpful for practicing

http://www.cplusplus.com/forum/articles/12974/
That's amazing. thanks for that bp. That's really helpful. Thank you. Thanks everyone.
Maybe you should go for designing. The pay is almost the same and it's easier compared to programming.


Yeah... Umm, unless one would be considered a good writer, that wouldn't be a career to pursue unless you really really want it.

It's not really something you just generically think up: "Hey, I might aswell become a game designer". Not only is it very hard to get a job at it, you have to be pretty good aswell.
Topic archived. No new replies allowed.