作者bleed1979 (十三)
看板C_and_CPP
标题Re: [问题] C++的一个小问题
时间Tue Apr 21 07:07:27 2009
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
1F:推 Jackwin:感谢 04/21 12:08