|
|
|
|
Ultra Member
|
|
Aug 5, 2007, 01:35 PM
|
|
How do I get it to stay on screen
OK, I've written this programme and I've compiled it but when I run it I enter some numbers and words then I have to press enter to get there but as soon as it displays it it closes how can I make it so it doesn't do that
|
|
|
Ultra Member
|
|
Aug 5, 2007, 03:37 PM
|
|
Hello
|
|
|
Ultra Member
|
|
Aug 6, 2007, 08:09 AM
|
|
Anybody there
|
|
|
Full Member
|
|
Aug 6, 2007, 09:47 AM
|
|
At the end of your code output something like "press enter to quit" and then read in one more character. This way you'll wait for the user to do something before the program terminates.
|
|
|
Ultra Member
|
|
Aug 6, 2007, 03:58 PM
|
|
I've tried that but it still closes after I put my information in then press enter to continue but it just goes dtraight to the end of the programme then closes in an instant
|
|
|
Full Member
|
|
Aug 6, 2007, 05:55 PM
|
|
No, put the "press enter to continue" as the very last thing in main()
|
|
|
Ultra Member
|
|
Aug 7, 2007, 03:37 PM
|
|
I put a code in which I was told coded for that just before the Return 0, could you give me an example of the code you mean
|
|
|
Ultra Member
|
|
Aug 8, 2007, 02:32 PM
|
|
This is the bit I put it
Cout << "Press Enter to exit";
Cin.ignore(std::cin.rdbuf()->in_avail() + 1);
|
|
|
Ultra Member
|
|
Aug 10, 2007, 07:00 AM
|
|
Any advice would be great
|
|
|
Full Member
|
|
Aug 10, 2007, 05:45 PM
|
|
I'm not sure what it is you're trying to do with the second line you listed. I've not used iostream in a while but I think something like this will work:
Code:
char junk;
cout << "Press Enter to exit" << endl;
cin >> junk;
|
|
|
Ultra Member
|
|
Aug 11, 2007, 07:36 AM
|
|
Originally Posted by asterisk_man
i'm not sure what it is you're trying to do with the second line you listed. i've not used iostream in a while but i think something like this will work:
Code:
char junk;
cout << "Press Enter to exit" << endl;
cin >> junk;
OK it stays on screen after I put the information in but it doesn't close after I press enter, the line that you said you wernt sure on it has that line in the book and its worked before to make my text stay on screen
|
|
|
Full Member
|
|
Aug 14, 2007, 06:20 AM
|
|
If you're really stumped you can always fall back on plain c and use stdio.h
|
|
|
Full Member
|
|
Aug 14, 2007, 06:35 PM
|
|
Cin >> tempchar; will only work if you actually give it a character to read... just pressing return won't advance the program.
If, instead, you use cin.get(tempchar); it will behave the way you want.
|
|
Question Tools |
Search this Question |
|
|
Check out some similar questions!
Blank screen after xp splash screen and then hangs
[ 2 Answers ]
My colleagues and I work in a tech environment and we have seen several computers with the same symptoms. Namely a failure to boot xp. After the xp logo screen the screen goes to blank and it just hangs.
This looks like a graphics card fault but changing card does nothing.
Booting into safe...
Having a problem moving my address bar from bottom of screen to top of screen
[ 11 Answers ]
Hello everyone,
I can't seem to bring up an address bar at the top of the screen because when I right click at the top of the page, the options are not lit up. I could only bring up an address bar at the bottom. Since it gets in the way at the bottom, I would like to know if anyone can help me...
Screen
[ 1 Answers ]
Customize my desktop?
If not there should be laptop settings to set the resolution and screen size
View more questions
Search
|