I'm on a terrible C++ training course. Please help. Questions [LONG].

Started by
64 comments, last by Blad3 18 years, 6 months ago
Agreed. To be honest if I have to continue with the course there's assignment questions to be answered, but what I'm really looking to get to is a text adventure, hoping that those skills will cross over to general programming job skills. "writing an operating system is not writing Microsoft Excel is not writing Halo is not writing a web server" but first I obviously have to learn general C++ to be able to do any of them. Knowing what level I'd have to be at to do any of that though is a mystery.

Extrarius, VERY helpful. I assume you didn't take the time out to write all that just for me? Thank's.
Advertisement
To make a text adventure, you need to know up to Functions, but Objects would make it easier to keep track of things in your head, and without knowing Arrays or Pointers, you won't be able to do anything fancy in your text adventure. With arrays, you could easily have many rooms, but only up to a maximum (the size of the array). With pointers, you could have any number of rooms because you could load them from a file and get more memory as you load more rooms from the file.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
OK, well, it seems like you haven't programmed before. Sorry if I didn't make myself clear before. You will need to learn the entire C++ language rock-solid to get hired for any development job in that language. You have to realise though that C++'s basic syntax takes up one book. All the other APIs and language extensions add capabilities for things like graphics, sound, networking, and more. None of this is provided in basic C++. You will have to learn all of C++, though.

If you want to be a general programmer, which most people start of as at first, you will need to learn a bit of several things. Graphics, to an extent, are a must. At least learn to use an API like SDL or Allegro, which will make things easier. You will want to learn how to use a GUI of some sort, like the Win32 API, which allows use of Window's GUI system. Once you have C++ down, though, then all these other APIs will come very quickly.
my siteGenius is 1% inspiration and 99% perspiration
Quote:Original post by Extrarius
The most important thing to remeber when you're learning to program is that your computer is NOT fragile! Feel free to experiement randomly, and make all kinds of little programs that do whatever you can figure out how to do. If you can't figure something out, find an example and change it in different ways to see what happens.


Agreed! I have probably 50 or 60 folders filled with random completed, not-so-complete, and barely worked on programs around the whole spectrum. Some completed games, like pong and minesweeper. Some half-completed stuff, like the GUI system I'm working on. Some stuff that will never be complete. All of it is great experience though, so experiment!

Quote:
Next, I'd really suggest that as you learn to program, you also learn good coding practices. For example, almost every programming books I've seen is full of really obscure abbreviations for variable names, things like actbal for "account balance" or weird stuff like that.
A good book on coding practices is Code Complete, 2nd Ed., but you want to learn at least the basics (variables, functions, how to use structures) before you read it because it will refer to all those things and tell you good ways to handle them.
It's more applicable to modern 'object oriented' languages (Java, C++, etc), but I still think it will teach you a lot about creating good code (just working isn't enough, it needs to be readable and maintainable also) even if the only language you know is plain C.


Writing clean code is good. I take time to make mine very easy to read and understand, but it could be better. The point of doing it this way is that if you are writing a program of any size, when you have to revisit parts of it, you need to be able to quickly and easily figure out exactly what you were thinking 3 weeks ago when you wrote that section. A more extreme example would be 3 years down the line, when some other guy has to maintain code you wrote. He needs to be able to understand what you were doing, too.

Also, listen to Extrarious. I think that he has said what needs to be said [grin]
my siteGenius is 1% inspiration and 99% perspiration
Extrarius, thanks yet again. So I need to know quite alot in or to start on a full-on text adventure? That's a good thing, because I assume having the goal of programming a text adventure will only help encourage me.

silverphyre673, you explained yourself very well. Knowing that after I learn C++ (which I need to know well) I'll need to learn several different API's (at least one) gives me a better understanding of where I'm going. I already knew about DX/Opengl.
You probably everything you need to know to make a text game now; it just takes a lot of code. You'll want to have a good grasp on printing, scanning, and random numbers, which really isn't a whole lot.
------------------------------Support the Blue Skies in Games Campaign!A blog... of sorts.As a general rule, if you don't have a general rule in your signature, you aren't as awesome as someone who does. General rules roxor teh big one one ones.
Writing an adventure would be good practice. Most likely, classes and pointers and such will help you, but you can always start with something simple. For example, once you get a good grasp of ints and loops, you can make a simple number guessing game. Ex: (C++)
#include <iostream> // So you can do much of the basic thingsusing namespace std; // Makes your life simpler(no std::)int main() // The main function{    int theNumber = 13; // Your number to guess    cout<<"Welcome to Guess My Number!!!"<<endl<<endl;                                         //^^^^  ^^^^ is to end the current line    cout<<"Your guess: "; // Whats the player's guess?    int theGuess; // The int that will store the player's guess    cin>>theGuess; // Input the guess    cin.ignore();    while (theGuess != theNumber) // The while loop!                                  // In english:                                  // While the players guess                                  // is different than the number                                  // then do this.    {        if (theGuess < theNumber)            cout<<"Go higher!"<<endl<<end;        else            cout<<"Go lower!"<<endl<<endl;        cout<<"Your guess: ";        cin>>theGuess;        cin.ignore();    }    cout<<"Thats it!"<<endl; // The player got out of the loop                             // so most likely he won!    return 0; // The end!}

Just take what you know and experiment. I think you should also get a good book like Beginning C++ Game Programming. This one teaches you C++ from a gaming perspective. Good luck!

-DBZ-

Edit: Later on, you can add a scoring system, a number of trys, etc.
-----------------------------....::::DRAGON BALL Z::::....C<<"+"<<"+"; // Go C++ !!!-----------------------------
Extrariusm, thanks for the code example/modification.

programwizard - ok, i'll try to code one, still on loops.


dudedbz1 - great example, I'm actually going to use that now, just reading over loops again though.

With the course(!) I think it's the five+ days you go in and they actually tutor you there that I'm really paying for. But until that time they basically want you to learn the language on your own. :@

You've seen those 5-day $2000+ dollar courses right? I've just paid for a modified version of that. The five days just isn't for beginners, so they want you to get ok first.
I started off programming by getting a book.(I had a very helpful friend who knew how to program pretty well and that helped too) I then 'made my own programs' by copying and pasting random parts of other programs. I know, its stupid, and you probably shouldn't do it. But it worked. After you copy and paste enough, you begin to understand what it does. You won't be able to find *exactly* what you want, so you change stuff that you have. This means that you won't understand all of the little tiny details, but thats what the web is for.

So I think that you can probably learn from that course, just not as well as you should for that price. Learn what you can, and remember, those are people which, if they know what they are doing, can answer your questions. Books can't really do that.

And check out the stickies on this forum if you haven't already. They tell you some good tutorials. Good luck programming!
I've been a professional developer for 5 years, and the most important thing about programming is learning how to solve problems. The reason you write a piece of code is to perform a task. You could know a language inside out, but if you can't work out the logic behind the task, you can't write the code. As an example, let's take a something very simple like making a cup of tea. You start off by boiling the kettle. If the kettle is empty, you need to fill it with water first. You then put a teabag in a mug, and add the water. Do you add milk? And sugar? If so, how many spoonfuls? Do you want a second cup?

As you can see, something that seems very simple to us has a number of decisions to make. It's identifying these and being able to structure them in pseudo-code that will make you a good programmer. So, it could be something like this:

Declare variables mug, teabag, kettle, water, milk, sugar, spoon

while I am thirsty:

If the kettle is empty, put water in it.
Boil the kettle.
Place teabag in mug.
Put water in mug.
If milk is required, add it.
If sugar is required, add the correct number of spoonfuls.

End loop

Having broken it down like this, if becomes quite clear how we should code it. First, we declare the objects that we need. Then, we'll use a while loop to decide how many times we need to repeat the process. An if statement tells us what to do if the kettle is empty. A function will boil it, another will put the teabag in the mug and one more will add the water. Another if statement tells us whether to add milk or not, and you'll be required to prompt the user for this data. The if statement to add the sugar will lead into a loop to add the correct number of spoonfuls, again derived from user interaction.

Once you have done this, all you need to do is turn it into proper code by applying the syntax of a language. The only way to learn this is by doing it; learning all the libraries out there takes time, but will come with experience.

This topic is closed to new replies.

Advertisement