Computer Science Canada Dev c++ beta 5 |
Author: | MysticVegeta [ Thu May 26, 2005 4:34 pm ] |
Post subject: | Dev c++ beta 5 |
Hi I have just started C++ and i am having a problem with the dev c++ beta 5. When i try to compile and run this code, The DOS window opens up and closes immediately EDIT: Oh nvm i think it works |
Author: | wtd [ Thu May 26, 2005 4:44 pm ] |
Post subject: | |
That's normal behavior. That window is created specifically to display output from your program. Your program runs very quickly, then quits, and once it's over, the window no longer has a reason to be open. Now, if you were waiting for the user to do something, like hit enter, it would stay open. |
Author: | MysticVegeta [ Fri May 27, 2005 3:39 pm ] | ||||
Post subject: | |||||
Yep. i got that thanks! Oh and by the ways, how do skip a line, like in turing we can
i tried
Doesn't work |
Author: | Mazer [ Fri May 27, 2005 4:12 pm ] | ||||
Post subject: | |||||
In your case, you'd want either:
OR
|
Author: | MysticVegeta [ Fri May 27, 2005 4:29 pm ] |
Post subject: | |
thanks |
Author: | wtd [ Fri May 27, 2005 4:40 pm ] | ||||
Post subject: | |||||
You can also always:
There's nothing special about:
std::endl is just another variable. |
Author: | jamonathin [ Fri May 27, 2005 4:41 pm ] |
Post subject: | |
Yeah the \n works, and as I saw in zylum's maze proggy, and \n skips a line in Turing as well |
Author: | wtd [ Fri May 27, 2005 4:46 pm ] |
Post subject: | |
Yes, because \n is the newline character. However, using std::endl is the more idiomatically correct C++ approach. |
Author: | MysticVegeta [ Fri May 27, 2005 8:43 pm ] |
Post subject: | |
Wow \n works for turing? whew i didnt know that! cool 8) Anyways what does std:: mean? |
Author: | wtd [ Fri May 27, 2005 10:13 pm ] | ||
Post subject: | |||
MysticVegeta wrote: Anyways what does std:: mean?
"std" is the name of the standard namespace in C++. The "::" is the namespace resolution operator. It's C++'s way of saying "the variable (or function, or class, or whatever) named endl in the std namespace". You can see this in action by creating your own namespace.
|