关于即时输出的有关问题

关于即时输出的问题我输到)时怎么不能即时输出C/C++ code#include stack#include iostream#include

关于即时输出的问题
我输到')'时怎么不能即时输出

C/C++ code
#include <stack>#include <iostream>#include <string>using namespace std;int main(){    char t;    int count=0;    stack<char> stk;    while(cin>>t)    {        stk.push(t);        if(t=='(')            ++count;        if(count&&t==')')        {            cout <<endl;            while(stk.top()!='(')            {                cout <<stk.top()<<" ";                stk.pop();            }            cout <<stk.top()<<endl;            stk.pop();            --count;        }    }    while(stk.empty()!=true)    {        cout <<stk.top()<<" ";        stk.pop();    }    cout <<endl;    return 0;}


[解决办法]

说实话,你的程序是用来做括号匹配吗???你说不能输出的问题,我看没有,输出是有的,但就是
  
不知道你的怎么结束输入........
  
还有你的输出是这样的:“ )( ”,如果是括号匹配的话,顺序貌似反了,我也不知道你写这程序的
 
初衷是什么...
[解决办法]
探讨
我输到')'时怎么不能即时输出

C/C++ code

#include <stack>
#include <iostream>
#include <string>
using namespace std;
int main()
{
char t;
int count=0;
stack<char> stk;
while(cin>>t)
……

[解决办法]
探讨
栈不就是反着输出的吗
回车 ctrl+z 结束输入
我想问的是当我输入时,为什么不是一输到')'就输出,而是要按回车才输出
这只是一道练习题

引用:
说实话,你的程序是用来做括号匹配吗???你说不能输出的问题,我看没有,输出是有的,但就是

不知道你的怎么结束输入........

还有你的输出是这样的:“ )( ”,如果是括号匹配的话,顺序貌似反了,我也不知……