All pastes #221928 Raw Edit

Anonymous

public text v1 · immutable
#221928 ·published 2006-10-25 23:24 UTC
rendered paste body
bool 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;
	}
}