看板 C_and_CPP 關於我們 聯絡資訊
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
Jackwin:感謝 04/21 12:08