德意志非洲军团标志:C语言程序问题,有耐心的高手进

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/06 07:47:58
#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);
}

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