Programming

You must have put it in wrong because it compiles fine for me (I copied and pasted from my post).
 
CivFan91 said:
I edited my post. It works now. It didn't because I had it in a Windows App instead of Command Prompt program. That tends to crimp the system a little.

Okay well now you're set and can basically learn all of the standard C++!
 
Souron said:
I sugget using "system("PAUSE");". You'd need to add the following line at the bigining:
#include <stdlib.h>

I wouldn't do that because it depends on your OS and it really isn't standard... It also writes extra stuff at the end of the program and you may not want that. However other cin commands in your file can cause problems so if you use cin at all, put this code before the cin.get();
cin.ignore();
 
homeyg said:
I wouldn't do that because it depends on your OS and it really isn't standard...
Windows/DOS is pretty standard, if you ask me. A windows based compiler will not make programs that run on other operating systems anyway. So unless you plan to compile your program for different operating systems, system("pause") should work just fine.

True that system("pause") does give a pause message. I do not think this is detrimental for a beginner's consol program.

And of course it should be noted that "pause" is a DOS command, not a C++ command.

Another function you could use is getch(), which is found in casio.h I believe. This will also only work on windows. This is also usefull for actually getting input from the player without using stdin.
 
To be honest, C++ makes little sense to me. It seems to be based on creating command prompt programs, and that doesn't hold well on my supa-system.

Look at the Win32 API then (at least for windows programming).

The easiest way to get the programs to stay on the screen is to run them from the command prompt (Start>Run and enter cmd). Personally I prefer to compile and run from the command prompt.
 
CivFan91 said:
Um... Okay... what is cin.ignore? Why does cin cause problems?

You'll have to learn more of the language. I can't explain easily if you don't know much of the language yet.
 
.... until you master big programming word: Pointers, you won't be considered as programmer nor you know C++.

Learning C++ syntax takes a week; learning how to use pointers properly takes years.

Also it seems that you don't have formal related mathematical knowledge- that is part that "real" programmer are made of.
 
Comraddict said:
.... until you master big programming word: Pointers, you won't be considered as programmer nor you know C++.

Also it seems that you don't have formal related mathematical knowledge- that is part that "real" programmer are made of.

I hope this isn't directed at me...
 
I thought Java automatically uses pointers without you specifying :confused:

Each time I try to learn C++ I get stuck at pointers :(
 
Quentin said:
I thought Java automatically uses pointers without you specifying :confused:

Each time I try to learn C++ I get stuck at pointers :(

Then I have one sentence to help you my friend. Are you ready? I'm only gonna say this once. *clears throat*

A pointer is a type of variable that holds a memory address.

This one sentence made the little light bulb click on in my head whenever I was stuck at pointers (a while back).
 
Souron said:
You can have function pointers too. Those don't point to memmory.

But that's really the exeption.

Yeah but I can guarantee he's having trouble with the pointer variables...
 
Back
Top Bottom