Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7863349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:27:17+00:00 2026-06-02T23:27:17+00:00

So I have an assignment where I’m supposed to code a Mayan calendar in

  • 0

So I have an assignment where I’m supposed to code a Mayan calendar in C++, in such a manner that the calendar has these 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 a Mayan date and a number of days. The
operation adds the number of days to the Mayan date to produce a Mayan
date as output. The second operation m-d subtracts the number of days
from the Mayan date to produce a Mayan date as output. The third
operation m-m calculates the number of days between two Mayan dates.
The fourth operation g= converts a Gregorian date to a Mayan date.
The final operation m= converts a Mayan date to a Gregorian date.

The mayan calendar units are set up in such a manner 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’m having trouble initializing the Mayan calendar object. Here is what I have so far:

class MayanDate {
// Bak'tun, Ka'tun, etc stuff ...
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;
};

I want to be able to set the units to equal the number of days they represent when I initialize the class, so it’ll be easier to work with them.

The code I have above isn’t compiling, and I can’t figure out why. Any pointers towards what I’m doing wrong would be extremely helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T23:27:18+00:00Added an answer on June 2, 2026 at 11:27 pm

    I think you should hold data in your class in Mayan style. You must have an ability to convert days from start of Maya epoch to it, like that:

    void toMayan(long long d)
    {
      kin = d % 20; d /= 20;
      unial = d % 18; d /= 18;
      tun = d %20; d /= 20;
      //...
    }
    

    And back conversion is simple: kin + 20 * (unial + 18 * (tun + 20 * (...)))

    Next, you should to know how calculate count of days in Gregorian calendar from some date to another. You can look at java’s Date class sources ( http://www.docjar.com/html/api/java/util/Date.java.html ) for example.

    And the last – you must know any Mayan date in Gregorian form to calculate differecne in days between calendars. Convert one date to days, subtract(or add) difference and then convert to other.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this assignment due that requires the usage of FLTK. The code is
I have an assignment that I'm supposed to implement the MIPS processor in C++
I have an assignment that converts dates from one calendar system to another. The
I have an assignment that is supposed to be written in C (not C++),
I have an assignment that wants me to write an ternary search algorithm and
I have an assignment that simulates a dice game. As part of the program,
I have an assignment in which I need to create a function that tells
I have an assignment where I am supposed to be able to display the
I have an assignment I'm working on that required me to render an image
I have an assignment to read a file and output the average test scores.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.