| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
Thanks a lot!!!
I learn something from you. ![]() |
|
#4
|
||||
|
||||
|
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 ![]() |
|
#5
|
||||
|
||||
|
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. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > How to pause in C |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|