IOperand *TOperand<T>::operator/(const IOperand &other) const { const std::string &left = this->toString(); const std::string &right = other.toString(); if (getPrecision() >= other.getPrecision()) return doDiv(getType(), left, right); else { IOperand *current = SOperandMaker::createOperand(other.getType(), left); IOperand *r = (*current / other); delete current; return r; } }
void doTopDown(int a,int b) { printf("Enter Your Choise: \n" "1. Add\t 2.Subtract\t 3.Multiply\t4.Divide \n"); int choise; scanf("%d",&choise); switch(choise) { case 1:doAdd(a,b); break; case 2:doSub(a,b); break; case 3:doMult(a,b); break; case 4:doDiv(a,b); break; default: printf("Wrong Choise \n"); } }