tma fate:C语言程序问题,有耐心的高手进

来源:百度文库 编辑:神马品牌网 时间:2024/05/09 08:41:21
#include <string.h>
main()
{ char str[80];int i=0,j;
clrscr();
for(;;)
{ scanf("%c",&str[i]);
if(str[i++]=='\n') break;
}
str[i]='\0';
for(j=0;j<i;j++)
printf("%c",str[r]);
}
请把此程序中%C格式改为%s格式,并简化

程序可能有问题,用 scanf("%c",&str[i]) 不能读入'\n'。

简化的程序如下:
#include<stdio.h>

main(){
  char str[80];
  scanf("%s",str);
  printf("%s", str);
}

不知题者是不是这个意思~~:)~~