#include "Algorithms_main.h"
void test1()
{
A_fixedStackStrings s(100);
using namespace std;
string t;
while (cin >> t && t != "#")
{
if (t != "-")
s.push(t);
else if (!s.isEmpty())
cout << s.pop()+" ";
}
cout << "(" <<s.size()<< " left on stack)" << endl;
getchar();
}
使用cin时,在键盘录入的数据以enter存入系统缓存,然后cin 开始读取,遇到空白结束录入,空白会被cin抓走,然后下一次从空白后开始读取。