Calendar Program

HI everyone..i'm new here..please help me in my project..a calendar program from year 2008 - 2010..please help me...ASAP..tnx..
You'll probably need to be more specific about your requirements.

I assume this is some kind of homework/assignment?

Is this a console app? What is its purpose? Have you programmed in C++ before?
yup.. i have a little bit experience in C++..but i'm still learning and i find it difficult... my programming teacher always tells us to do different kinds of programs, but she didn't even try to discuss it to our class and explain how we are going to start..
you should post here a code of what you've tried to do. It's easier for us to help you if you have some errors or wrong functions. Good luck.
2008 hangang 2010.......kmi my calendar program din 1900-2020.....pg ngwa qo pkita qo xe..
I have been messing about with time_t and it's associated functions over the past couple of weeks.
That might be a good place to start looking.
Search out time_t on this website
First of all you must find the mathematical formula what day the 1st of jan for any year begins. Check that out on Yahoo answers.
I've been looking at doing this sort of thing too, inputting a day of a month of a year, and have it spit out the day of the week.

I'll take a look at it.
You can use functions from the ctime library to achieve this.
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
//need to include this header
#include <time.h> 

    
    char *weekDays[] = { "Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

    tm timeStruct;

    int yearReqd = 2008; //the year you want to check
    //zero the structure. We will set some params later
    memset(&timeStruct, 0, sizeof(timeStruct));

    timeStruct.tm_year = yearReqd - 1900; // the value required in this member is the offset from year 1900
    timeStruct.tm_mon = 0;  //0 (january) -> 11 (December)
    timeStruct.tm_mday = 1; // day of the month

   //call the mktime function. This will return a value indicating the number of seconds since 00:00 hrs 1 Jan 1970 or -1 error code 
//if it cannot calculate a valid time,
//we are interested in the side effect in that it will fill in the tm_wday member of the structure. 
//This will have a value 0 (Sunday) to 6 (Saturday)

    if ( mktime(&timeStruct) != -1)
    {
        cout << "The first day of year " << yearReqd << " is a  " << weekDays[timeStruct.tm_wday] << endl;
    }
    else
    {
        //error stuff here
    }


Last edited on
Boost Date-Time Library :)

http://www.boost.org/doc/libs/1_35_0/doc/html/date_time.html

Boost offer open-source multi-platform standards compliant C++ libraries. Many of the Boost libraries will actually be part of the 2009 C++ Standard. So it's a good choice to use them if you have the choice.
Last edited on
A number of people hare are suggesting the use of this library.
I've recently acquired a book Beyond The C++ Standard Library - An Introduction To Boost, so I'll be getting into that in the v.near future.
Boost is a good addition to your toolset. It's not uncommon for job descriptions to have "Boost" listed as a required skill.

Personally, I am a fan of
foreach - allows you to go
1
2
3
4
// I have #define foreach BOOST_FOREACH so I can use foreach :)
BOOST_FOREACH(string mystring, vstringlist) {
 cout << "String From Vector Is: " << mystring << endl;
}


thread - platform independent multi-threading.

program options - Automatic handling of command line parameters.
e.g
 
./run --help --version --verbose
Last edited on
geeezz!
thats my project too!
but its a calendar from 1901 to 2008!
i have started in my C++!

but im not yet done!
anyone can help me?
:D

ill send the code!
Topic archived. No new replies allowed.