题目链接 答题思路是利用二维字符串数组对数据吸收,然后倒叙输出;
#pragma warning(disable:4996);
#include <iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<stack>
using namespace std
;
int main()
{
char word
[100][80];
int x
= 0;
do { scanf("%s", word
[x
++]); } while (getchar() != '\n');
for (int i
= x
- 1;i
>= 0;i
--)
{
if (i
!= 0) cout
<< word
[i
] << " ";
else cout
<< word
[i
] << endl
;
}
return 0;
}
转载请注明原文地址: https://mac.8miu.com/read-496174.html