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
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    As for Github, I often frequent there, boasting about my genetic algorithm for tools-assisted speedrunning and such. I'm also pretty active on Discord, with my tag @asperatology.
  • tom_mai78101 tom_mai78101:
    Yeah, the whole earthquake + air pollution combo made me completely forget about bringing updates. I'll be sure to keep on top of things after all things are less requiring my attentions.
    +2
  • The Helper The Helper:
    I am just glad that you are OK Tom! Thank you for the update!
  • Varine Varine:
    Glad to hear you're okay! I only knew about your Github cuz I tried to follow some of you when I was learning how to program, but didn't understand any of it so kind of quit paying attention to what anyone does on it
  • The Helper The Helper:
    Freaking storm outside is kicking!
  • Blackveiled Blackveiled:
    I wouldn't know, I'm in Joliet, Illinois right now working. I left Houston area about 2 weeks ago lol
  • Blackveiled Blackveiled:
    Not permanently of course, just a temporary job.
    +1
  • jonas jonas:
    Glad you're ok @tom_mai78101
  • jonas jonas:
    @Blackveiled you know another word for permanent? temporary
    +1
  • Varine Varine:
    Briefly, he'll only be there for the interim. Like a stopgap of sorts, he'll be back home in short time
  • O Old Mountain Shadow:
    Hurray! Tom has reappeared!
  • The Helper The Helper:
    Happy Thursday!
  • Blackveiled Blackveiled:
    Yep. Just another fun night at work.
  • Varine Varine:
    Broke the nozzle on my 3d printer and I don't have another heater block. So... I guess I'm fucked on that this weekend
  • The Helper The Helper:
    that sucks i bet they are expensive
  • Varine Varine:
    Not really
  • Varine Varine:
    The entire hot end is like 20 dollars, I just can't get anymore until next week
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top