Compare commits
No commits in common. "1ce23256c1d0dd740caebea7050578d1e57007ce" and "f9b655d9cedb128916db2d569cfff755ce275c3f" have entirely different histories.
1ce23256c1
...
f9b655d9ce
2 changed files with 0 additions and 59 deletions
|
@ -1,26 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Victor Le Roch on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef BE_TORTUE_H
|
|
||||||
#define BE_TORTUE_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class Tortue{
|
|
||||||
private:
|
|
||||||
std::string nom;
|
|
||||||
int naissance;
|
|
||||||
std::string sexe;
|
|
||||||
public:
|
|
||||||
Tortue(const std::string &nom, const std::string &sexe);
|
|
||||||
|
|
||||||
const std::string &getNom() const;
|
|
||||||
|
|
||||||
int getNaissance() const;
|
|
||||||
int getAge() const;
|
|
||||||
|
|
||||||
const std::string &getSexe() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //BE_TORTUE_H
|
|
|
@ -1,33 +0,0 @@
|
||||||
//
|
|
||||||
// Created by Victor Le Roch on 20/05/2020.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "../include/Tortue.h"
|
|
||||||
#include "../../core_simulation.h"
|
|
||||||
//#include <string>
|
|
||||||
|
|
||||||
const std::string &Tortue::getNom() const {
|
|
||||||
return nom;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Tortue::getNaissance() const {
|
|
||||||
return naissance;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::string &Tortue::getSexe() const {
|
|
||||||
return sexe;
|
|
||||||
}
|
|
||||||
|
|
||||||
Tortue::Tortue(const string &nom, const string &sexe) : nom(nom), sexe(sexe) {
|
|
||||||
naissance = std::time(nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
int Tortue::getAge() const {
|
|
||||||
int ageSec = std::time(nullptr) - naissance;
|
|
||||||
int ageHour = ageSec/(60*60);
|
|
||||||
int ageDay = ageHour/24;
|
|
||||||
int age = ageDay / 365.25;
|
|
||||||
return age;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue