c++ primer 的有关问题

c++ primer 的问题
输入一个字符串,直到输入')'停止;然后从右昨个删除元素,直到遇到’(‘位置;
程序运行了,但后面的貌似没有输出....求大神帮我看下啊~~~~~~~
#include <iostream>
#include <string>
#include <stack>
using namespace std;

int main ()
{
stack<char> stac;
string exp;
cout<<"enter an expression:"<<endl;
cin>>exp;
string::iterator ix=exp.begin();
while(ix!=exp.end()){
if(*ix!=')')
stac.push(*ix);
else{
while(stac.top()='('||!stac.empty())
stac.pop();
}

}
if(stac.empty())
cout<<"stac not matched"<<endl;
else{
stac.pop();
stac.push('@');
}
ix++;
system("pause");
  return 0;
}


------解决方案--------------------
while(stac.top()='('||!stac.empty()
应该是不等号吧?
------解决方案--------------------
else{
while(stac.top()!='('||!stac.empty())
stac.pop();
}