#include<stdio.h>
int main(void)
{
char str[81][81];
int cnt=0;
int i,j;
int out=0;
for(i=0;i<81;i++){
for(j=0;j<81;j++){
scanf("%c",&str[i][j]);
if(str[i][j]==' '){
str[i][j]='\0';
cnt++;
break;
}
if(str[i][j]=='\n'){
str[i][j]='\0';
cnt++;
out=1;
break;
}
}
if(out){
break;
}
}
cnt-=1;
for(;cnt>0;cnt--){
printf("%s ",str[cnt]);
}
printf("%s",str[0]);
// while(cnt>-1){
// if(cnt>0){
// printf("%s ",str[cnt]);
// }
// else{
// printf("%s\n",str[cnt]);
// }
// cnt--;
// }
return 0;
}
PAT 1009 说反话
最新推荐文章于 2021-05-25 21:48:56 发布
本文介绍了一个使用C语言实现的简单程序,该程序能够读取用户输入的字符直到遇到空行,并逆序输出所有已读取的字符串。通过二维字符数组存储每一行的输入,利用`scanf`进行字符读取,并在输出阶段采用倒序遍历的方法来实现逆序输出。
471

被折叠的 条评论
为什么被折叠?



