Dev-C++ compiler 問題, 請入......??

2008-02-11 2:58 pm
我個programme 係可以run到同埋冇errors.......

但係個黑色windows 出左黎, 跟住我type in some value.......

然後個黑色野出左答案 之後 就自己「關閉」左.......

我想要一個detailful step by step.... >> ty so much!!

(p.s. : 我係c code rather than c++ code in my case...)

回答 (2)

2008-02-11 7:54 pm
✔ 最佳答案
你在你的程式碼最後加一句便行:
void main(...) {
...
system("pause");
}
因為Window default 是完成程式後自動關閉有關視窗,pause 就可以讓你按任意鍵後才關閉。
2008-02-11 8:02 pm
You have a rather common problem with dev-C++ running under Windows.
Your program has probably run comletely and correctly, but when it finishes, the window closes immediately, so fast that you do not see the rest of the results.

One way to get around it is to force an input character (just like in Java) before it terminates. For example:

...
printf("Press enter to exit program\n") ;
getchar();
return 0;
}
You can also refer to the following question which has a similar as yours.
http://hk.knowledge.yahoo.com/question/?qid=7008020200249



收錄日期: 2021-04-13 15:06:48
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080211000051KK00583

檢視 Wayback Machine 備份