// maarich.cpp: implementation of the maarich class. // ////////////////////////////////////////////////////////////////////// #include "maarich.h" #include #include ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// maarich::maarich() { } maarich::~maarich() { } void maarich::inputman() { cout<<"Please input mantisa num"<>mantisa; cout<<"Please input exponent num"<>exponent; } void maarich::showman() { cout<<"Mantisa is : "<< mantisa << endl; cout<<"Exponent is: "<< exponent<< endl; } float maarich::getman() { return(mantisa); } float maarich::getexp() { return(exponent); } maarich maarich::operator + (maarich num) { maarich help; if (exponent>num.exponent) { help.exponent =num.exponent; help.mantisa=num.mantisa + mantisa*pow(10,(exponent-num.exponent)); } else { help.exponent=exponent; help.mantisa= mantisa + num.mantisa*pow(10,(num.exponent-exponent)); } return (help); } maarich maarich::operator - (maarich num) { maarich help; if (exponent>num.exponent) { help.exponent =num.exponent; help.mantisa=num.mantisa - mantisa*pow(10,(exponent-num.exponent)); } else { help.exponent=exponent; help.mantisa= mantisa - num.mantisa*pow(10,(num.exponent-exponent)); } return (help); } maarich maarich::operator * (maarich num) { maarich help; help.mantisa=mantisa * num.mantisa; help.exponent =exponent+num.exponent; return (help); } maarich maarich::operator / (maarich num) { maarich help; help.mantisa= mantisa / num.mantisa; help.exponent = exponent- num.exponent; return (help); } void maarich::operator = (maarich num) { mantisa=num.getman(); exponent=num.getexp(); }