while(~scanf("%s",s))这个语句就是关键,当你有多个输入是就可以使用。下面这个程序的作用是对输入的字符串进行倒序输出
#include <stdio.h>
#include <string.h>
int main()
{
char s[100];
while(~scanf("%s",s))
{
int n;
n=strlen(s);
for(int i=n-1; i>=0; i--)
{
printf("%c", s[i]);
}
printf("\n");
}
return 0;
}