472,793 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,793 software developers and data experts.

Program Closes

hi all,

im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks like this:

return 0;

}

anyone know what i'm doing wrong?

thanks, eric
Jul 23 '05 #1
1 3184
On Sat, 21 May 2005 06:00:26 UTC, "Eric Whittaker" <ew****@adelphia.net>
wrote:
hi all,

im trying to write my first c++ program. a success, but i can't get the
window to stay open after user enters input. it just automatically closes.
right now the end of my program looks like this:

return 0;

}

anyone know what i'm doing wrong?

thanks, eric


Eric,

We need a little more information to help you. What kind of
program are you writing? If the code is small enough perhaps
some of it could be posted.

You mention that the end of your program has the above
statement. I'm going to guess that you wrote a simple
"hello world" type program. Thatwould indicate to me
that the program was a console program or whatever your
operating system calls it. Anyway, if you're using a
windows based view by running the program by "clicking
on it from Explorer under Windows" and the program is
just a console application, that is the correct behavior.
Two things are happening. One is that your program is
running. Second, once the program has run the
automatically started console session closed. To change
this behavior, open a console session and use the
command line to move to and run your program. When the
program is done you will still have the console window
open so you can view the results.

If you are talking about the above line being the
end of your program and the program have a graphics
interface (window), the end of the program will end
the window. In that case you need to provide some
method to keep the program open for a while longer.

If all else fails, ask one more question with your
program -- "press enter to end program" and wait
for input.

David

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
5
by: Phil Galey | last post by:
VB.NET 2002 on Windows 2000 SP 3 When I start my program, the NotifyIcon appears in the tray, as it should. However, when I close the program, the NotifyIcon remains until I hover over it with...
3
by: Luke | last post by:
I have a program that exits just fine when you close it manually, but throws an unhandled exception when I try to log off windows. It suggests I enable the JIT debugger, but when I compile the...
2
by: dkoco | last post by:
I have a C#.Net program that once a button is clicked it goes to a public class(called Tal) and gets data in a vector, then exits the class, and goes back to the main form(program). I will do this...
1
by: amir | last post by:
Hello all, I have a db file .mdf in my program. I wander if it saves it everytime values are inserted and if not how can it be done ? furthermore i want to know where can i see the .mdf file after...
4
by: canteyn | last post by:
Ok here is my problem. I am coding a program that uses 3 different functions, and the end result is that the program reads in (x,y) points from a file, and then outputs those points to another file,...
3
by: manontheedge | last post by:
I'm having a problem when I work with Access using VB6. I don't have a problem controlling Access, but I want the Access file to stay open when the program ends...but it always closes itself, and I...
2
by: revenant81 | last post by:
I'm writing a program which has to execute a command, get its output and show it on a treeview. This command runs for a very long time. I want to end the execution of the command when the user...
4
by: Jonny Relentless | last post by:
After adding a form to a C# program, I am unable to use it. I want to use form1 as a sort of menu, so that when the user clicks a button, form1 will close and form2 (or form3, etc) will open. What...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.