C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 14th, 2005, 11:16 AM
Sun Sun is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 24 Sun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 3 m 19 sec
Reputation Power: 0
Unhappy How to pause in C

Hi everyone,

I am a beginner of C, and C++. Now, I have a question, when I write C++, I will write a cin.get () ; to pause the window.

But, what should I write in C to have the same function??

Because I run the C programme, the window close too fast before I can see anything.

Thank you very much for your help.

Regards,
Sun.

Reply With Quote
  #2  
Old July 14th, 2005, 11:40 AM
Diocletian Diocletian is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 2 Diocletian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 28 m 49 sec
Reputation Power: 0
I always just add a separate variable, and for a cin at the end of the program. I think I only run into the window-dropping problem with VS 6.0, seems to hang on the screen untill closed with .net. I'm sure there's a pause function of some sort out there, but I've always felt it was easier to do it this way:

int main()
{
Int m;


--All of your code here--

cin >> m;
}
Kind of sloppy, but it works.

Reply With Quote
  #3  
Old July 14th, 2005, 12:13 PM
Sun Sun is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 24 Sun User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 3 m 19 sec
Reputation Power: 0
Thanks a lot!!!

I learn something from you.

Reply With Quote
  #4  
Old July 14th, 2005, 12:13 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
I agree, There probably is a better way of doing it, but I do the same thing. If you are writing a program were you want your user to see the final result of there last question or something it always helps to have the last operation, the user inputting some type of integer. and just to add to your code Diocletian, you could also do something like this!!
Code:
int main()
{
Int m;


--All of your code here--

cout>>" Enter 1 To exit \n";
cin >> m;
}

Just to make it a little more formal to the user

Reply With Quote
  #5  
Old July 14th, 2005, 03:04 PM
B-Con's Avatar
B-Con B-Con is offline
:bcon: moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Location: int main()
Posts: 351 B-Con User rank is Private First Class (20 - 50 Reputation Level)B-Con User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 23 h 8 m 6 sec
Reputation Power: 4
The C equivilent of "cin.get()" is "getchar()", it does the exact same thing.
__________________
Officially a member of the Itsacon fan club. Beer blasts are every friday at Viper_SB's house. I bring the chips.



Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > How to pause in C


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT