/*
3 单词反转:
对一个输入的单词反转
例如输入 I am a student. 则输出 .tneduts a ma I
*/
#include<iostream>
#include<stdio.h>
#include<stack>
using namespace std;
int main()
{
stack<char> s;
char n;
cout << "输入需要反转的字符串:" << endl;
n = getchar();
while (n != '\n')
{
s.push(n);
n = getchar();
}
while (!s.empty())
{
cout << s.top();
s.pop();
}
cout << endl;
system("pause");
return 0;
}
3 单词反转: 对一个输入的单词反转 例如输入 I am a student. 则输出 .tneduts a ma I
猜你喜欢
转载自blog.csdn.net/qq_33221533/article/details/94021757
今日推荐
周排行