0
点赞
收藏
分享

微信扫一扫

B1009 说反话 (20 分)

千妈小语 2023-01-09 阅读 112


#include <iostream>
#include <string.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
char str[90];
cin.getline(str, 90);
int len = strlen(str);
int num = 0;
char ans[90][90];
int r = 0, h = 0;
for(int i = 0; i < len; i++){
if(str[i] != ' '){
ans[r][h++] = str[i];
} else{
r++;
h = 0;
}
}

for(int i = r; i > 0; i--){
cout << ans[i] << " ";
}
cout << ans[0];
return 0;
}


举报

相关推荐

0 条评论