I have a Date class. In this class :(Date.h)

class Date
{
       ...
public:
      static Date creatDate (char *stringDate)
      ....
};

Date.cpp:
I want to creat an array like this: stringDate[2][12] = {{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; I started at:

Date Date::creatDate (char *stringDate)
{
}

I don't know how to write code for this function. Please help me!

How do you want to generate the arrays; is it by incrementing the second number from a previous array (as I see it) ? If not, pls shed more light on your problem.

How can I get day of week?
I have a Date class:

class Date
{
    private:
       m_day;
       m_month;
       m_year;
    public:
       int getDayofWeek();
       int getWeekofYear();
       
};

with definition:

#define Sunday	       0
#define Monday	       1
#define Tuesday	       2
#define Wednesday       3
#define Thursday	       4
#define Friday	               5
#define Saturday	       6

in ur getdayof week(), ask the user to input a number corresponding to the day of choice e.g 1 for sunday, 2 for tuesday,etc,assign the choice to an int variable; then switch() the variable. In each case.e.g case 1: return the variable to the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.