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 7912321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:34:18+00:00 2026-06-03T13:34:18+00:00

When my program starts, I want it to immediately fill the Calendar class with

  • 0

When my program starts, I want it to immediately fill the “Calendar” class with all years/months/days from 1/1/1875 until 31/12/2025. I’m having trouble creating this “Calendar” class, I don’t really know what my options are with C++.

theclass

What’s the best way to realize this? Should the day/month/year be a multimap, and if so; how can I efficiently use that multimap to achieve what I’m trying to do (can multimaps even hold more than 2 objects?)? Or maybe the class shouldn’t be a class at all, but the whole thing should be turned into a multimap?

I made this “calendar” project up as an example, but I think my question really comes down to:
“How do I design a class (or alternative) that can hold multiple layers of data that are linked and easy to control/access”.

And by ‘control’ I mean add/delete/check-if-already-exists etc.

So maybe something like this (ignoring my example in the picture):

calendar.addYear(1998) //Add 1998 to the year stack (array?) inside the "calendar" object.
calendar.addMonth(1,0) //Add month 1 (january) to month stack (array?) keeping year-array position 0 as a reference, so we know what year this month belongs to.
calendar.addDay(1,0) //Add day 1 to day stack (array?) keeping month-array position 0 as a reference, so we know which month this day belongs to.

An example of something that I would want to programatically achieve with a class like this is:

//This is a magical GUI object I just made up ;D
myGUIofChoiceCreateSomeGUIobject GUIobject;
int i;
for(i=0; i < calendar.yearCount; i++;)
{
    GUIobject.addYeartoGUIobject(calendar.year[i]); //Add current year to our GUI. The user can now select it, hooray!
    addMonthsToYear(i); //Add months belonging to this year to our GUI.
}

addMonthsToYear(int theYear)
{
    int i;
    for(i=0; i < calendar.year[theYear].monthCount; i++;)
    {
        /*
        Our made-up GUI will add the current month to the year we received as an 
        argument. As long as that year is selected in the GUI, our user can pick this month, 
        hooray!
        */
        GUIobject.addMonthToGUIobject(calendar.year[theYear].month[i])
        addDaysToMonth(i,theYear) //Add days to this month (not typing this one down, you can see where this is going)
    }
}

And as if all of this wasn’t complicated enough; what is a calendar without to-do items? So the “calendar.day” needs to linked to an array/multimap/whatever of objects, which could look like this:

struct stuffToDo{
    std::string message;
    float time;
}

after which it should be easy to add an object like that to the class:

stuffToDo newstuff;
newstuff.message = "Find a C++ tutor so you can stop bothering stackoverflow";
newstuff.time = 15.20;

calendar.year[2012].month[11].day[18].addObject(newstuff);

I’m at a loss, what are my options here?

PS. I’m sorry for the inconsistency between my examples, but it was kind of inevitable without knowing what I’m supposed to do, which is the essence of this question.

  • 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-03T13:34:19+00:00Added an answer on June 3, 2026 at 1:34 pm

    Boost library is what you need to look at..

    And to help yourself you can find the
    calendar class you wanna to make here
    http://sourceforge.net/projects/c-cpp-calender/

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

Sidebar

Related Questions

I want to make a script that starts a program and then sends it
i want to set localnotification say for a program which starts at 6:00 pm.For
I want my SQLite database instance to be wiped away when the program starts.
My program moves files from one folder to another immediately upon creation. The files
I have a list of images. When the program starts I want to clone
I'm a starting C/C++ programmer. What I want is the following thing: Start program,
I want to start my successfully installed Java program after the installation finished. I
I want to remote debug the nodejs program in Eclipse. I start the node
When the program starts, a new JFrame is created. Once the user clicks the
I have a program that starts up and creates an in-memory data model and

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.