1.整行输入/分隔输出
题目描述:
在所有的输出规范中,最标准也最普通的便是一行输出一个数值。本题要求对于每个输入的数据,按照原样输出两组数据之间空一行
输入:
多组数据
每行有长度小于50的字符串
输出:
原样输出每组字符串
两组数据之间空一行
输入样例:
hello world
hello kitty
show me your code
#include <stdio.h>
输出样例:
hello world
hello kitty
show me your code
#include <stdio.h>
代码实现:
#include<stdio.h>
int main()
{
char s[50];
while(gets(s)){
puts(s);
printf("\n");
}
return 0;
}
关于scanf的循环输入需要加EOF。
#include<stdio.h>
int main()
{
char s[20];
while(scanf("%s",s)!=EOF){
printf("%s\n",s);
}
return 0;
}