2016-03-03 18:30:01 +00:00
|
|
|
#include "DivisionEuclidienne.h"
|
|
|
|
|
2016-03-04 07:49:31 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-03-03 18:30:01 +00:00
|
|
|
/* [0] CONSTRUCTEUR
|
|
|
|
=========================================================*/
|
|
|
|
DivisionEuclidienne::DivisionEuclidienne(){
|
|
|
|
this->init(2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* [1] Renvoie le nom du type de calcul
|
|
|
|
=========================================================*/
|
|
|
|
std::string DivisionEuclidienne::getLibelle(){
|
2016-03-04 07:49:31 +00:00
|
|
|
return "a / b = ib + j";
|
2016-03-03 18:30:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* [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;
|
|
|
|
}
|