0

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!

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

2
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by tkud
0

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.

0

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

Edited by peter_budo: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.