rendered paste bodybool Calculator::oper(char op){
myComplex hold;
if (pop(hold)){
if (!mPtop){
push(hold);
}
else{
if (op == '/'){
if (!hold.re && !hold.im){
if (!hold.re)
(*mPtop).re = (*mPtop).re/hold.re;
if (!hold.im)
(*mPtop).im = (*mPtop).im/hold.im;
return true;
}
}
if (op == '*'){
(*mPtop).re = (*mPtop).re*hold.re;
(*mPtop).im = (*mPtop).im*hold.im;
return true;
}
if (op == '+'){
(*mPtop).re = (*mPtop).re+hold.re;
(*mPtop).im = (*mPtop).im+hold.im;
return true;
}
if (op == '-'){
(*mPtop).re = (*mPtop).re-hold.re;
(*mPtop).im = (*mPtop).im-hold.im;
return true;
}
}
return false;
}
}