So, I have an appointment where I have to code the Mayan calendar in C ++, so that the calendar has the following functions:
argv[1] | argv[2] | argv[3] | output
m+d | Mayan date | number of days | Mayan date
m-d | Mayan date | number of days | Mayan date
m-m | Mayan date | Mayan date | number of days
g= | Gregorian date | | Mayan date
m= | Mayan date | | Gregorian date
The first operation m + d takes the Mayan date and the number of days. the operation adds the number of days to the Mayan date for the production of the Mayan date as a way out. The second operation md subtracts the number of days from the Mayan date to release the Mayan date. The third mm operation calculates the number of days between two Mayan dates. The fourth operation g = converts the Gregorian date to Mayan date. The last operation m = converts the Mayan date to a Gregorian date.
Mayan calendar units are set up so that:
Days Long Count period Long Count unit
1 1 Kin
20 20 Kin 1 Uinal
360 18 Uinal 1 Tun
7,200 20 Tun 1 Ka'tun
144,000 20 Ka'tun 1 Bak'tun
2,880,000 20 Bak'tun 1 Pictun
57,600,000 20 Pictun 1 Kalabtun
1,152,000,000 20 Kalabtun 1 K'inchiltun
23,040,000,000 20 K'inchiltun 1 Alautun
I am having trouble initializing a Mayan calendar object. Here is what I still have:
class MayanDate {
unsigned int Kin = 1;
unsigned int Uinal = 20;
unsigned int Tun = 360;
unsigned int Katun = 7200;
unsigned int Baktun = 144000;
unsigned int Pictun = 2880000;
unsigned int Kalabtun = 57600000;
unsigned long Kinchiltun = 1152000000;
unsigned long Alautun = 23040000000;
public:
MayanDate();
MayanDate( unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
void set( unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
MayanDate &operator++();
int operator-( const MayanDate &) const;
MayanDate operator+( unsigned int ) const;
MayanDate operator-( unsigned int) const;
bool operator==( const MayanDate & ) const;
bool operator!=(const MayanDate & m ) const;
void get_string( char*, unsigned int) const;
};
, , , , .
, , , , . , , .