27 lines
775 B
C++
27 lines
775 B
C++
|
#include "DivisionEuclidienne.h"
|
||
|
|
||
|
/* [0] CONSTRUCTEUR
|
||
|
=========================================================*/
|
||
|
DivisionEuclidienne::DivisionEuclidienne(){
|
||
|
this->init(2);
|
||
|
}
|
||
|
|
||
|
/* [1] Renvoie le nom du type de calcul
|
||
|
=========================================================*/
|
||
|
std::string DivisionEuclidienne::getLibelle(){
|
||
|
return "Division euclidienne";
|
||
|
}
|
||
|
|
||
|
/* [2] Effectue le calcul et renvoie le resultat
|
||
|
=========================================================*/
|
||
|
float* DivisionEuclidienne::calc(){
|
||
|
int division = this->operands[0] / this->operands[1];
|
||
|
int reste = (int)(this->operands[0]) % (int)(this->operands[1]);
|
||
|
|
||
|
this->result = (float*) malloc(2*sizeof(float));
|
||
|
|
||
|
this->result[0] = (float) division;
|
||
|
this->result[1] = (float) reste;
|
||
|
|
||
|
return this->result;
|
||
|
}
|