Re: [問題] C++的一個小問題

看板C_and_CPP (C/C++)作者 (十三)時間16年前 (2009/04/21 07:07), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
use while loop and u can type Ctrl + Z to escape from the loop. #include <stdio.h> #include <stdlib.h> int main(void) { int areacode; printf("輸入欲查詢區域號碼, 0可省略\n"); while(scanf("%d",&areacode) == 1) { switch (areacode) { case 2: printf("台北市或台北縣\n"); break; case 3: printf("桃竹、宜蘭花蓮\n"); break; default: printf("查無此區域\n"); } printf("輸入欲查詢區域號碼, 0可省略\n"); } return 0; } ※ 引述《Jackwin (穎川健)》之銘言: : #include <stdio.h> : #include <stdlib.h> : int main(void) : { : int areacode; : printf("輸入欲查詢區域號碼, 0可省略\n"); : scanf("%d",&areacode); : switch (areacode) : { : case 2: : printf("台北市或台北縣\n"); : break; : case 3: : printf("桃竹、宜蘭花蓮\n"); : break; : default: : printf("查無此區域\n"); : } : system("pause"); : return 0; : } : 簡單寫了這個程式 : 我想問 要怎麼改才能讓動作繼續執行不會離開視窗? : 就是不會出現"請案任意鍵繼續..."然後就關掉這樣 : 小弟剛學C語言 請求高手教教我 -- World of bleed1979 http://bleed1979.myweb.hinet.net/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.168.134.135

04/21 12:08, , 1F
感謝
04/21 12:08, 1F
文章代碼(AID): #19xG0oCy (C_and_CPP)
文章代碼(AID): #19xG0oCy (C_and_CPP)