-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.cpp
42 lines (33 loc) · 803 Bytes
/
date.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// Created by sages on 10/10/2018.
//
#include <iostream>
#include "date.h"
namespace datum{
date::date():
days{1},
months{1},
years{0}
{}
std::string date::get_date(){
int year = days/365;
int temp = days%year;
int month{0};
for (int i=0;i<monthnumbers.size();i++){
if ((temp-monthnumbers[i])<=0)
{
int month = i +1;
break;
}
else{
month = 0;
}
}
int day = days - (years*365) - (months*31);
std::cout<<days<<"\n";
return std::to_string(day) + "-" + std::to_string(month) + "-" + std::to_string(year);
}
void date::increment_date(int increment) {
days = days + increment;
}
}