PAT_Basic 1009
来源:互联网 发布:数控车床编程模拟器 编辑:程序博客网 时间:2024/05/10 22:14
This time I meet something interesting about coding
First is coding
/*给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello World Here I Come输出样例:Come I Here World Hello*/#include <vector>#include <string>#include <iostream>#include <stack>using namespace std;void main(){stack<string> stk;string tmp_in;while (cin>>tmp_in ){stk.push(tmp_in);}while (!stk.empty()){string tmp_s = stk.top();//fflush(stdin);cout << tmp_s;stk.pop();}system("pause");}
Then when we get into the first circle, we type in the strings and try to end the circle.
while (cin>>tmp_in ){stk.push(tmp_in);}
Then we find out if we try "Ctrl+C" it can get out directly but failed in the next circle.
When we type "Ctrl+Z" and "Enter", everything is fine.
Interesting.
0 0
- PAT_Basic 1009
- PAT_Basic --- 1002
- PAT_Basic --- 1003
- PAT_Basic --- 1004
- PAT_Basic --- 1005
- PAT_Basic --- 1006
- PAT_Basic 1007
- PAT_Basic 1008
- PAT_Basic 1010
- PAT_Basic 1011
- PAT_Basic 1012
- PAT_Basic 1013
- PAT_Basic 1014
- PAT_Basic 1016
- PAT_Basic 1017
- PAT_Basic 1018
- PAT_Basic 1019
- PAT_Basic 1020
- java script 显示缩略词
- css3的nth-child选择器的详细探讨
- 软工大作业·源物语(一)
- bzoj4008: [HNOI2015]亚瑟王
- [LeetCode]233. Number of Digit One
- PAT_Basic 1009
- Java多线程下载的实现方法
- spring整合JMS(7)
- java并发--Executor 框架
- 观察者模式——Android控件的交互事件监听
- Qt中ui文件的使用
- Lightoj 1422(区间dp)
- 利用apach-poi进行excel多表格导出
- 初认SSH框架