Jump to content
  • Advertisement
Sign in to follow this  
Whomemi

Aww HeLp!!

This topic is 4846 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey Guys I just went out and bought myself a book and i downloaded the Dev C++ Compiler The thing is i seem to be having a problem which im sure is very easy to fix for u guys but im new and i need to be tought a few things. id write in the box and when i compile and run the dos screen comes up real fast and then leaves withen seconds of even knowing what was Can Some Help me out? all i can think of is thiers a typo Sumwhere. Here's the easy Demo !! (Sorry if its basic Everyone gotta start sumwhere!) #include <iostream> using namespace std; int main(){ cout << "Never Fear, C++ is here!"; return 0; }

Share this post


Link to post
Share on other sites
Advertisement
Hey,
Try this code:

#include <iostream>
using namespace std;

int main()
{
cout<<"Never fear! C++ is here!"<<endl;
cin.get();
}



\That will work. Also, Good Luck studying Programing.
Chad.

Share this post


Link to post
Share on other sites
I believe if you add "cin.get();" after the cout line, the DOS window will wait for you to press a key, thus keeping it on screen. I've only been learning for about a month, so if anyone has a better way, I stand corrected.

EDIT: i guess this is a kind of "two-person" double post (same answer). He beat me by ten seconds. I would have gotten there before if I didn't forget to log in and so I had to retype

Share this post


Link to post
Share on other sites
haha Great It worked Thanks Guys Now i can actually start reading and learning NO more stoping me!

1 question thow How did u guys know that? Same experience Or just really smart!

Share this post


Link to post
Share on other sites
Like everything else, it's just something you learn as you go. Personally, I use while(!_kbhit()); to do the same thing. I don't know if it's a deprecated function in the modern sense, but it works fine for me. Good luck!

Share this post


Link to post
Share on other sites
Similar experience. I have done a little learning with Dev-Cpp and the CProgramming.com tutorials (although I plan to get a book when I'm done with my current VB.NET project for a school club). It covered that in the tutorials, and I played around on my own and I found it neccessary.

Share this post


Link to post
Share on other sites
Personally I like to use:

sytem("pause");


Mainly because it waits and outputs "Press any key to continue . . ." to the console.

Share this post


Link to post
Share on other sites
Well, before I switched to VS.NET 2003 (handles that automatically), and used DevC++, I'd usually use cin.get(), but system("PAUSE") works well, also.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!