Link to home
Start Free TrialLog in
Avatar of nationnon
nationnon

asked on

keeping the info up with a function

I'm have a little problem keeping my output to stay up when it calculates the answer.  It doesn't ask you to hit a key to exit or nothing.  It just shuts off.  It works fine when I execute in visual c++ but when I send the program out with it's own exe it doesn't.  Can't I create a function that will cut it off in 5 seconds?  Or atleast ask the user to hit a key to continue?
Avatar of Andrei Rodionov
Andrei Rodionov
Flag of Russian Federation image

Hi nationnon,

Is your application a Win32 console? If so then you can use

#include <iostream.h>
#include <conio.h>
....
char c;

cout.flush();
cout << "Press any key to continue...";
c = getch();    // waits here
....

to wait until user's response.

Andrew.
ASKER CERTIFIED SOLUTION
Avatar of Andrei Rodionov
Andrei Rodionov
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RONSLOW
RONSLOW

if it is console mode, then run it from a command prompt window.

Alterntaively, make it into a simple dialog (or SDI app with edit view) and have it write to a multi-line edit box that the user can scroll through to view the results and then close when they've seen enough.