MS DOS and Windows 7 issues

Gizzledorf

New Member
Reaction score
0
I'm an amateur programmer and recently downloaded Dev-C++ to start tinkering around with code. I wrote a fairly simple console program and compiled it and attempted to run it. However, on start up, the MS DOS window with my program in it opened and closed immediately, not even letting me see my finished product. Is this a normal occurence, or am I doing something wrong? I uninstalled avast!, hoping that it would help, but the same thing happened. Any ideas on what is going on?? Any help at all would be greatly appreciated. :)

Specs- HP Pavilion dv6 notebook PC w/ 6 GB RAM and 64 bit Windows 7 Home Premium
 

UndeadDragon

Super Moderator
Reaction score
447
My guess is that it has something to do with your code.

Would you mind posting it?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
My guess is it is because your programm probably runs too fast and after its done it is closed immediately.
What you need to do is have the user press a button at the end for the programm to finish.
Dont know much about C++ but in C you could just place a scanf function at the end.
 

Gizzledorf

New Member
Reaction score
0
//my first program in C++

#include <iostream>
using namespace std;

int main ()
{
cout<< "Hello World!";
cout<< "I'm a C++ program";
return 0;
}

It's just some sample code that i got from a C++ website. tried running it again today with the same result as before.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Just like i said, it runs through and closes immediately because your machine is probably too fast. (not that anything could not be too fast to run this simple programm)
You need some form of input retrieval at the end, something that makes the programm wait for you to press some key.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top