首页 > 编程语言 > 详细

C语言:标准输入读取几行输入。每行输入都要打印到标准输出上,前面加上行号。行号不能有限制

时间:2015-10-13 13:54:49      阅读:363      评论:0      收藏:0      [点我收藏+]
#include<stdio.h>

#include<stdlib.h>

int main()

{

 char str;

 int count=1;

 int start=1;

 while(1)

 { 

  printf("input your line\n");

  do

  {

   scanf("%c",&str);

   if(start==1)

   {

    printf("%d.",count);

    start=0;

   }

   printf("%c",str);

  }while(str!=‘\n‘);

  start=1;

  count++;

 }

C语言:标准输入读取几行输入。每行输入都要打印到标准输出上,前面加上行号。行号不能有限制

原文:http://10740184.blog.51cto.com/10730184/1702483

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!