請問一個Dev-C++的笨問題^^|||...
請問各位大大~
小弟最近想學c++,而朋友介紹dev-c++這套免費的軟體... 但不知道為何每次照著書上的範例key完,一按執行就"閃"了個dos視窗, 然後就沒了~根本還來不及看run的結果=_=||| 請問是哪裡的設定有問題嗎? 系統是xp run的程式碼: #include <iostream.h> int main(); intmain() { cout << "hello world!\n"; return 0; } 麻煩各位教我一下 :o 感激不盡 |
將程式碼改為如下
看完結果可以按任何鍵去結束程式 #include <iostream.h> #include <conio.h> int main(); int main() { char c; cout << "hello world!\n"; c=getche(); return 0; } 或是直接到 XP 的命令提示字元去執行 |
把程式改成下列的樣子…
#include <iostream.h> #include <stdio.h>----------→加入常用的標頭檔 #include <stdlib.h>----------→加入常用的標頭檔 int main(); intmain() { cout << "hello world!\n"; system("PAUSE");----------------→加上這一行 return 0; } 這樣就可以了… |
所有時間均為台北時間。現在的時間是 09:56 PM。 |
Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2024, Jelsoft Enterprises Ltd.
『服務條款』
* 有問題不知道該怎麼解決嗎?請聯絡本站的系統管理員 *