Ask Experts Questions for FREE Help!
  Advanced
Register  |  Log in  
   Ask    
 Answer  
  Help  

Ask QuestionsprogressAnswer QuestionsprogressBuild ReputationprogressBecome an Expert
 
Free Answers in 3 Easy Steps

Register Now
3 Steps

At Ask Me Help Desk you can ask questions in any topic and have them answered for free by our experts. To ask questions or participate in answering them you must register for a free account. By registering you will be able to:
  • Get free answers from experts in any of our 300+ topics.
  • Accept money for answers that you provide.
  • Communicate privately with other members (PM).
  • See fewer ads.

Home > Computers & Technology > Programming > Compiled Languages > C++   »   how do i get it to stay on screen

 
Question Tools Search this Question Display Modes
Question
 
 
#1  
Old Aug 5, 2007, 12:35 PM
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
how do i get it to stay on screen

ok, ive writen this programme and ive 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 doesnt do that

Reply With Quote
 
     

Answers
 
 
Old Aug 5, 2007, 02:37 PM   #2  
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
hello
  Reply With Quote
 
     
 
 
Old Aug 6, 2007, 07:09 AM   #3  
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
anybody there
  Reply With Quote
 
     
 
 
Old Aug 6, 2007, 08:47 AM   #4  
asterisk_man
Full Member
asterisk_man is offline
 
asterisk_man's Avatar
 
Join Date: Nov 2006
Location: East coast of U.S.A.
Posts: 472
asterisk_man See this member's comment history on his/her Profile page.
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.
  Reply With Quote
 
     
 
 
Old Aug 6, 2007, 02:58 PM   #5  
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
ive 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
  Reply With Quote
 
     
 
 
Old Aug 6, 2007, 04:55 PM   #6  
asterisk_man
Full Member
asterisk_man is offline
 
asterisk_man's Avatar
 
Join Date: Nov 2006
Location: East coast of U.S.A.
Posts: 472
asterisk_man See this member's comment history on his/her Profile page.
no, put the "press enter to continue" as the very last thing in main()
  Reply With Quote
 
     
 
 
Old Aug 7, 2007, 02:37 PM   #7  
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
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
  Reply With Quote
 
     
 
 
Old Aug 8, 2007, 01:32 PM   #8  
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
this is the bit i put it

cout << "Press Enter to exit";
cin.ignore(std::cin.rdbuf()->in_avail() + 1);
  Reply With Quote
 
     
 
 
Old Aug 10, 2007, 06:00 AM   #9  
albear
Senior Member
albear is offline
 
Join Date: Apr 2007
Location: strawberry fields
Posts: 665
albear See this member's comment history on his/her Profile page.
any advice would be great
  Reply With Quote
 
     
 
 
Old Aug 10, 2007, 04:45 PM   #10  
asterisk_man
Full Member
asterisk_man is offline
 
asterisk_man's Avatar
 
Join Date: Nov 2006
Location: East coast of U.S.A.
Posts: 472
asterisk_man See this member's comment history on his/her Profile page.
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;
  Reply With Quote
 
     


Question Tools Search this Question
Search this Question:

Advanced Search
Display Modes

 
Similar Sponsors

Similar Questions
Question Asker Topic Answers Last Post
Blank screen after xp splash screen and then hangs kulakat Windows 1 Dec 4, 2007 03:03 AM
black screen after windows splash screen windows xp ktdonline Computers for Beginners 2 Mar 20, 2007 05:00 AM
Having a problem moving my address bar from bottom of screen to top of screen rsfd Windows 11 Jan 2, 2006 09:30 AM
Re: Screen i_need_help Windows 1 Nov 17, 2004 10:00 AM
pc on, nothing on screen asandoval Desktops 5 Oct 27, 2004 12:28 PM




Copyright ©2003 - 2007, Ask Me Help Desk.
All times are GMT -8. The time now is 08:49 PM.

Content Relevant URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc.