您的位置:首页 > 其它

从标准输入读取几行输入。每行输入都要打印到标准输出上,前面加上行号,使能够处理的输入行的长度没有限制

2016-05-30 15:01 453 查看
#include <stdio.h>
#include<stdlib.h>
int main ()
{
char ch;
int start=1;
int n=1;
while(1)
{
printf("input your line\n")	;
do
{
scanf("%c",&ch);
if(start==1)
{
start=0;
printf("%d.",n);
}
printf("%c",ch);
}while(ch!='\n');
start=1;
n++;
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: