[ create a new paste ] login | about

Link: http://codepad.org/nDmrZhj2    [ raw code | output | fork ]

C++, pasted on Nov 8:
  // date.h file 
using namespace std;
#include <iostream>
#include <string>
class Date
{
        private:
                int year;
                int month;
                int day;
                bool shortDisplay;
                const int MonthDays [12]={31,28,31,30,31,30,31,31,30,31,30,31};
                const int DaysAtMonthEnd [12]={31,59,90,120,151,181,212,243,273,
                        304,334,365};
                const int SECONDSINYEAR = 31536900;
        public:
                Date();
                Date(int yy, int mm, int dd);
                Date(int yy, int mm);
                Date(int yy);
                Date(const Date &otherDate);
                Date(string dateStr);
                void setDate(int yy, int mm, int dd);
                void setDate(int yy, int mm);
                void setDate(int yy);
                void setDate(const Date &otherDate);
                void setDate(string dateStr);
                void setYear(int yy);
                void setMonth(int mm);
                void setDay(int dd);
                int getYear();
                int getMonth();
                int getDay();
                void setShortDisplay();
                void setLongDisplay();
                bool isShortDisplay();
                void operator++();
                int operator+=(int dd);
                bool operator==(Date &otherDate);
                bool operator<(Date &iotherDate);
                string toString();
                string monthString(int month);

        friend ostream &operator << (ostream &, Date &);
        friend istream &operator >> (istream &, Date &);
};


Output:
1
2
Line 12: error: a brace-enclosed initializer is not allowed here before '{' token
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: