コード例 #1
0
ファイル: 生日问题.cpp プロジェクト: NEWPLAN/Sources
int main(){
  int n, m;
  scanf("%d%d", &n, &m);
  printf("%.8lf\n", birthday(n, m));
  printf("%.8lf\n", birthday2(n, m));
  return 0;
}  
コード例 #2
0
void BoostDateTimeTestCase::test_gregorian_daysAlive()
{
    std::string s("2012-01-17");
    try 
    {
        boost::gregorian::date  birthday(boost::gregorian::from_simple_string(s));
        boost::gregorian::date  today = boost::gregorian::day_clock::local_day();
        boost::gregorian::days  days_alive = today - birthday;
        boost::gregorian::days  one_day(1);

        if(days_alive == one_day)
        {
            std::cout << "Born yesterday, very funny" << std::endl;
        }
        else if(days_alive < boost::gregorian::days(0))
        {
            std::cout << "Not born yet, hmm: " << days_alive.days() 
                      << " days" <<std::endl;
        }
        else
        {
            std::cout << "Days alive: " << days_alive.days() << std::endl;
        }

    }
    catch(...) 
    {
        std::cout << "Bad date entered: " << s << std::endl;
    }
}
コード例 #3
0
ファイル: date4.cpp プロジェクト: ychmrsk/cpp
void g()
{
  Date birthday(1960, 12, 31);
  ++birthday.d;  // invalid date

  Date today(1970, 2, 3);
  today.m = 14;  // invalid date
}
コード例 #4
0
ファイル: eg9_4_3.cpp プロジェクト: zhuyoujun/pppuc
int main()
{
	//Date my_birthday;
	Date birthday(1970,12,30);
	//birthday.m = 14; // error
	std::cout << birthday.month() << std::endl;
	return 0;
}
コード例 #5
0
void TestCase4_DestructorCleanMemory(void)
{
#if defined (ASSIGNMENT_OPERATOR_OVERLOAD)
	Date birthday(1983,1,2);
	birthday.display();

	return;
#endif	/*  ASSIGNMENT_OPERATOR_OVERLOAD  */
}
コード例 #6
0
ファイル: xyz.c プロジェクト: dk00/old-stuff
/* Tzu */
int
x_birthday()
{
  strcpy(vetitle, "[¥Í¤é§Ö¼Ö¡I]");
  birthday(YEA);

  more("etc/birth.today", YEA);
  return 0;
}
コード例 #7
0
void Contact::setBirthday(CTime newBirthday)
{
	dataNasterii = CTime(newBirthday);
	time_t osBinaryTime = dataNasterii.GetTime();
	char time_ch[50];
	sprintf(time_ch, "%ld", osBinaryTime);
	CString birthday(time_ch);
	extraInfo = birthday;
	birthday_set = true;

}
コード例 #8
0
int main() {
  person john;
  john.name = "John";
  john.age = 27;

  printf("%s is %d years old.\n", john.name, john.age);
  birthday(&john);
  printf("Happy birthday! %s is now %d years old.\n", john.name, john.age);

  return 0;
}
コード例 #9
0
int ContactViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 5)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 5;
    }
#ifndef QT_NO_PROPERTIES
    else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0:
            *reinterpret_cast< QString*>(_v) = firstName();
            break;
        case 1:
            *reinterpret_cast< QString*>(_v) = lastName();
            break;
        case 2:
            *reinterpret_cast< QDateTime*>(_v) = birthday();
            break;
        case 3:
            *reinterpret_cast< QString*>(_v) = formattedBirthday();
            break;
        case 4:
            *reinterpret_cast< QString*>(_v) = email();
            break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::WriteProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 5;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
コード例 #10
0
void TestCase4_How2UseCopyConstructor(void)
{
#if defined (COPY_CONSTRUCTOR)
	// 1st Date object
	Date birthday(1983, 1, 2);
	birthday.display();

	// 2nd Date object
	Date newday = birthday;
	newday.display();

	// 3rd Date object
	Date lastday(birthday);
	lastday.display();
	return;
#endif	/*  COPY_CONSTRUCTOR  */
}
コード例 #11
0
void TestCase4_OverloadedAssignmentOperator(void)
{
#if defined (ASSIGNMENT_OPERATOR_OVERLOAD)
	/* First Date's object
	 */
	Date birthday(1940, 6, 24);
	birthday.display();

	/* Second Date's object
	 */
	Date newday(1941, 7, 29);
	newday.display();

	/* Assign the 1st Date's object to the 2nd Date's object.
	 */
	newday = birthday;
	newday.display();

	return;
#endif	/*  ASSIGNMENT_OPERATOR_OVERLOAD  */
}
コード例 #12
0
void TestCase4_ReturnObjAssignOperator(void)
{
#if defined (ASSIGNMENT_OPERATOR_OVERLOAD)
	// Original date
	Date birthday(2014, 6, 24);
	Date old_day, new_day;

	// Assign 1st to 2nd to 3rd
#if 1
	old_day = new_day = birthday;
#else
	old_day = birthday;
	new_day = birthday;
#endif

	birthday.display();
	new_day.display();
	old_day.display();
	
	return;
#endif
}
コード例 #13
0
ファイル: LiveAuth.cpp プロジェクト: Artanomell/schat
void LiveAuth::dataReady()
{
  OAUTH_PREPARE_REPLY

  QVariantMap data = JSON::parse(raw).toMap();
  QByteArray uid = data.value(LS("id")).toByteArray();
  if (uid.isEmpty())
    return setError("invalid_uid");

  User user;
  user.name  = data.value(LS("name")).toString();
  user.email = data.value(LS("emails")).toMap().value(LS("account")).toString();
  user.link  = data.value(LS("link")).toString();

  Birthday birthday(data.value(LS("birth_day")).toInt(), data.value(LS("birth_month")).toInt(), data.value(LS("birth_year")).toInt());
  if (birthday.isValid())
    user.birthday = birthday.toString();

  QByteArray id = SimpleID::encode(SimpleID::make("live:" + uid, SimpleID::UserId));
  AuthCore::state()->add(new AuthStateData(m_state, "live", id, data, user));

  log(NodeLog::InfoLevel, "Data is successfully received, id:" + id + ", uid:" + uid);
}
コード例 #14
0
ファイル: entrybase.cpp プロジェクト: ForNeVeR/leechcraft
	QList<QPair<QString, QVariant>> EntryBase::GetVCardRepresentation () const
	{
		Account_->GetClientConnection ()->FetchVCard (GetJID ());

		const auto vcard = GetVCard ();

		QList<QPair<QString, QVariant>> result
		{
			{ tr ("Photo"), QImage::fromData (vcard.photo ()) },
			{ "JID", vcard.from () },
			{ tr ("Real name"), vcard.fullName () },
			{ tr ("Birthday"), vcard.birthday () },
			{ "URL", vcard.url () },
			{ tr ("About"), vcard.description () }
		};

		for (const auto& phone : vcard.phones ())
		{
			if (phone.number ().isEmpty ())
				continue;

			QStringList attrs;
			if (phone.type () & QXmppVCardPhone::Preferred)
				attrs << tr ("preferred");
			if (phone.type () & QXmppVCardPhone::Home)
				attrs << tr ("home");
			if (phone.type () & QXmppVCardPhone::Work)
				attrs << tr ("work");
			if (phone.type () & QXmppVCardPhone::Cell)
				attrs << tr ("cell");

			result.append ({ tr ("Phone"), attrs.isEmpty () ?
						phone.number () :
						phone.number () + " (" + attrs.join (", ") + ")" });
		}

		for (const auto& email : vcard.emails ())
		{
			if (email.address ().isEmpty ())
				continue;

			QStringList attrs;
			if (email.type () == QXmppVCardEmail::Preferred)
				attrs << tr ("preferred");
			if (email.type () == QXmppVCardEmail::Home)
				attrs << tr ("home");
			if (email.type () == QXmppVCardEmail::Work)
				attrs << tr ("work");
			if (email.type () == QXmppVCardEmail::X400)
				attrs << "X400";

			result.append ({ "Email", attrs.isEmpty () ?
						email.address () :
						email.address () + " (" + attrs.join (", ") + ")" });
		}

		for (const auto& address : vcard.addresses ())
		{
			if ((address.country () + address.locality () + address.postcode () +
					address.region () + address.street ()).isEmpty ())
				continue;

			QStringList attrs;
			if (address.type () & QXmppVCardAddress::Home)
				attrs << tr ("home");
			if (address.type () & QXmppVCardAddress::Work)
				attrs << tr ("work");
			if (address.type () & QXmppVCardAddress::Postal)
				attrs << tr ("postal");
			if (address.type () & QXmppVCardAddress::Preferred)
				attrs << tr ("preferred");

			QString str;
			QStringList fields;
			auto addField = [&fields] (const QString& label, const QString& val)
			{
				if (!val.isEmpty ())
					fields << label.arg (val);
			};
			addField (tr ("Country: %1"), address.country ());
			addField (tr ("Region: %1"), address.region ());
			addField (tr ("Locality: %1", "User's locality"), address.locality ());
			addField (tr ("Street: %1"), address.street ());
			addField (tr ("Postal code: %1"), address.postcode ());

			result.append ({ tr ("Address"), fields });
		}

#if QXMPP_VERSION >= 0x000800
		const auto& orgInfo = vcard.organization ();
		result.append ({ tr ("Organization"), orgInfo.organization () });
		result.append ({ tr ("Organization unit"), orgInfo.unit () });
		result.append ({ tr ("Job title"), orgInfo.title () });
		result.append ({ tr ("Job role"), orgInfo.role () });
#endif
		return result;
	}
コード例 #15
0
ファイル: date4.cpp プロジェクト: ychmrsk/cpp
void f()
{
  Date birthday(1970, 12, 30);
  birthday.m = 14;  // error : Date::m is a private member
  cout << birthday.month() << endl;  // ok
}
コード例 #16
0
ファイル: opimcontact.cpp プロジェクト: opieproject/opie
/*!
  Returns a rich text formatted QString representing the contents the contact.
*/
QString OPimContact::toRichText() const
{
    QString text;
    QString value, comp, state;
    QString str;
    bool marker = false;

    Config cfg( "qpe" );
    cfg.setGroup( "Appearance" );
    int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State );

    // name, jobtitle and company
    if ( !( value = fullName() ).isEmpty() )
        text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString( value ) + "</h3></b>";

    if ( !( value = jobTitle() ).isEmpty() )
        text += Qtopia::escapeString( value ) + " ";

    comp = company();
    if ( !( value = department() ).isEmpty() )
    {
        text += Qtopia::escapeString( value );
        if ( comp )
            text += ", " + Qtopia::escapeString( comp );
    }
    else if ( comp )
        text += "<br>" + Qtopia::escapeString( comp );
    text += "<br><hr>";

    // defailt email
    QString defEmail = defaultEmail();
    if ( !defEmail.isEmpty() )
    {
        text += "<b><img src=\"addressbook/email\"> " + QObject::tr( "Default Email: " ) + "</b>"
                + Qtopia::escapeString( defEmail );
        marker = true;
    }

    // business address
    if ( !businessStreet().isEmpty() || !businessCity().isEmpty() ||
            !businessZip().isEmpty() || !businessCountry().isEmpty() )
    {
        text += QObject::tr( "<br><b>Work Address:</b>" );
        marker = true;
    }

    if ( !( value = businessStreet() ).isEmpty() )
    {
        text += "<br>" + Qtopia::escapeString( value );
        marker = true;
    }

    switch ( addressformat )
    {
    case Zip_City_State:
        { //  Zip_Code City, State
            state = businessState();
            if ( !( value = businessZip() ).isEmpty() )
            {
                text += "<br>" + Qtopia::escapeString( value ) + " ";
                marker = true;

            }
            if ( !( value = businessCity() ).isEmpty() )
            {
                marker = true;
                if ( businessZip().isEmpty() && !businessStreet().isEmpty() )
                    text += "<br>";
                text += Qtopia::escapeString( value );
                if ( state )
                    text += ", " + Qtopia::escapeString( state );
            }
            else if ( !state.isEmpty() )
            {
                text += "<br>" + Qtopia::escapeString( state );
                marker = true;
            }
            break;
        }
    case City_State_Zip:
        { // City, State Zip_Code
            state = businessState();
            if ( !( value = businessCity() ).isEmpty() )
            {
                marker = true;
                text += "<br>" + Qtopia::escapeString( value );
                if ( state )
                    text += ", " + Qtopia::escapeString( state );
            }
            else if ( !state.isEmpty() )
            {
                text += "<br>" + Qtopia::escapeString( state );
                marker = true;
            }
            if ( !( value = businessZip() ).isEmpty() )
            {
                text += " " + Qtopia::escapeString( value );
                marker = true;
            }
            break;
        }
    }

    if ( !( value = businessCountry() ).isEmpty() )
    {
        text += "<br>" + Qtopia::escapeString( value );
        marker = true;
    }

    // rest of Business data
    str = office();
    if ( !str.isEmpty() )
    {
        text += "<br><b>" + QObject::tr( "Office: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = businessWebpage();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr( "Business Web Page: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = businessPhone();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr( "Business Phone: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = businessFax();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr( "Business Fax: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = businessMobile();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr( "Business Mobile: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = businessPager();
    if ( !str.isEmpty() )
    {
        text += "<br><b>" + QObject::tr( "Business Pager: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }

    // text += "<br>";

    // home address
    if ( !homeStreet().isEmpty() || !homeCity().isEmpty() ||
            !homeZip().isEmpty() || !homeCountry().isEmpty() )
    {
        text += QObject::tr( "<br><b>Home Address:</b>" );
        marker = true;
    }

    if ( !( value = homeStreet() ).isEmpty() )
    {
        text += "<br>" + Qtopia::escapeString( value );
        marker = true;
    }

    switch ( addressformat )
    {
    case Zip_City_State:
        { //  Zip_Code City, State
            state = homeState();
            if ( !( value = homeZip() ).isEmpty() )
            {
                text += "<br>" + Qtopia::escapeString( value ) + " ";
                marker = true;
            }
            if ( !( value = homeCity() ).isEmpty() )
            {
                marker = true;
                if ( homeZip().isEmpty() && !homeStreet().isEmpty() )
                    text += "<br>";
                text += Qtopia::escapeString( value );
                if ( !state.isEmpty() )
                    text += ", " + Qtopia::escapeString( state );
            }
            else if ( !state.isEmpty() )
            {
                text += "<br>" + Qtopia::escapeString( state );
                marker = true;
            }
            break;
        }
    case City_State_Zip:
        { // City, State Zip_Code
            state = homeState();
            if ( !( value = homeCity() ).isEmpty() )
            {
                marker = true;
                text += "<br>" + Qtopia::escapeString( value );
                if ( state )
                    text += ", " + Qtopia::escapeString( state );
            }
            else if ( !state.isEmpty() )
            {
                text += "<br>" + Qtopia::escapeString( state );
                marker = true;
            }
            if ( !( value = homeZip() ).isEmpty() )
            {
                text += " " + Qtopia::escapeString( value );
                marker = true;
            }
            break;
        }
    }

    if ( !( value = homeCountry() ).isEmpty() )
    {
        text += "<br>" + Qtopia::escapeString( value );
        marker = true;
    }

    // rest of Home data
    str = homeWebpage();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr( "Home Web Page: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = homePhone();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr( "Home Phone: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = homeFax();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr( "Home Fax: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }
    str = homeMobile();
    if ( !str.isEmpty() )
    {
        text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr( "Home Mobile: " ) + "</b>"
                + Qtopia::escapeString( str );
        marker = true;
    }

    if ( marker )
        text += "<br><hr>";

    // the rest...
    str = emails();
    if ( !str.isEmpty() && ( str != defEmail ) )
        text += "<br><b>" + QObject::tr( "All Emails: " ) + "</b>"
                + Qtopia::escapeString( str );
    str = profession();
    if ( !str.isEmpty() )
        text += "<br><b>" + QObject::tr( "Profession: " ) + "</b>"
                + Qtopia::escapeString( str );
    str = assistant();
    if ( !str.isEmpty() )
        text += "<br><b>" + QObject::tr( "Assistant: " ) + "</b>"
                + Qtopia::escapeString( str );
    str = manager();
    if ( !str.isEmpty() )
        text += "<br><b>" + QObject::tr( "Manager: " ) + "</b>"
                + Qtopia::escapeString( str );
    str = gender();
    if ( !str.isEmpty() && str.toInt() != 0 )
    {
        text += "<br>";
        if ( str.toInt() == 1 )
            str = QObject::tr( "Male" );
        else if ( str.toInt() == 2 )
            str = QObject::tr( "Female" );
        text += "<b>" + QObject::tr( "Gender: " ) + "</b>" + str;
    }
    str = spouse();
    if ( !str.isEmpty() )
        text += "<br><b>" + QObject::tr( "Spouse: " ) + "</b>"
                + Qtopia::escapeString( str );
    if ( birthday().isValid() )
    {
        str = TimeString::numberDateString( birthday() );
        text += "<br><b>" + QObject::tr( "Birthday: " ) + "</b>"
                + Qtopia::escapeString( str );
    }
    if ( anniversary().isValid() )
    {
        str = TimeString::numberDateString( anniversary() );
        text += "<br><b>" + QObject::tr( "Anniversary: " ) + "</b>"
                + Qtopia::escapeString( str );
    }
    str = children();
    if ( !str.isEmpty() )
        text += "<br><b>" + QObject::tr( "Children: " ) + "</b>"
                + Qtopia::escapeString( str );

    str = nickname();
    if ( !str.isEmpty() )
        text += "<br><b>" + QObject::tr( "Nickname: " ) + "</b>"
                + Qtopia::escapeString( str );

    // categories
    if ( categoryNames( "Contacts" ).count() )
    {
        text += "<br><b>" + QObject::tr( "Category:" ) + "</b> ";
        text += categoryNames( "Contacts" ).join( ", " );
    }

    // notes last
    if ( !( value = notes() ).isEmpty() )
    {
        text += "<br><hr><b>" + QObject::tr( "Notes:" ) + "</b> ";
        QRegExp reg( "\n" );

        //QString tmp = Qtopia::escapeString(value);
        QString tmp = QStyleSheet::convertFromPlainText( value );
        //tmp.replace( reg, "<br>" );
        text += "<br>" + tmp + "<br>";
    }
    return text;
}
コード例 #17
0
ファイル: datedemo.cpp プロジェクト: Eric-Schnipke/snippets
void test()
{
      cout << " zDate Class Demo \n\n";

      // default constructor, Jan 1 0000
      zDate a;
      cout << a << endl;
      // Various versions of the constructors
      zDate x(zDate::oct,20,1962);
      cout << x << endl;
      // constructor with a julian
      zDate z( 2450000L );
      cout << z << endl;
      // make a date with system date (tests copy constructor)
      zDate s(zDate::Today());
      cout << s << endl;
      // init with the day of year
      zDate y(33, 1996);
      cout << y << endl;
      // init from current system time
      time_t secs_now = time(NULL);
      zDate n(localtime(&secs_now));
      cout << n << endl;

      // using date addition and subtraction
      zDate adder = x + 10;
      cout << adder << endl;
      adder = adder - 25;
      cout << adder << endl;

      //using subtraction of two date objects
      zDate a1(zDate::Today());
      zDate a2 = a1 + 14;
      cout << (a1 - a2) << endl;
      cout << (a2 += 10) << endl;

      a1++;
      cout << "Tommorrow= " << a1 << endl;

      a1 = zDate(zDate::jul, 14, 1991);
      cout << "a1 (7-14-91) < a2 (" << a2
             << ")? ==> " << ((a1 < a2) ? "TRUE" : "FALSE") << endl;
      cout << "a1 (7-14-91) > a2 ("<< a2
             << ")? ==> " << ((a1 > a2) ? "TRUE" : "FALSE") << endl;
      cout << "a1 (7-14-91) < 8-01-91 ? ==> "
             << ((a1 < zDate(zDate::aug, 1, 1991)) ? "TRUE" : "FALSE") << endl;
      cout << "a1 (7-14-91) > 8-01-91 ? ==> "
             << ((a1 > zDate(zDate::aug, 1, 1991)) ? "TRUE" : "FALSE") << endl;
      cout << "a1 (7-14-91) == 7-14-91 ? ==> "
             << ((a1==zDate(zDate::jul, 14, 1991)) ? "TRUE" : "FALSE") << endl;
      zDate a3 = a1;

      cout << "a1 (" << a1 << ") == a3 (" << a3
             << ") ? ==> " << ((a1==a3) ? "TRUE" : "FALSE") << endl;
      zDate a4 = a1;
      ++a4;
      cout << "a1 ("<< a1 <<") == a4 (" << a4
             << ") ? ==> " << ((a1==a4) ? "TRUE" : "FALSE") << endl;

      zDate a5(zDate::Today());
      cout << "Today is: " << a5 << endl;
      a4 = zDate::Today();
      cout << "Today (a4) is: " << a4 << endl;

      cout << "Today + 4 is: " << (a4 += 4) << endl;
      a4 = zDate::Today();
      cout << "Today - 4 is: " << (a4 -= 4) << endl;
      cout << "=========== Leap Year Test ===========\n";
      a1 = zDate(zDate::jan, 15, 1992);
      cout << a1 << "\t" << ((a1.IsLeapYear()) ? "Leap" : "non-Leap");
      cout << "\t" << "day of year:  " << a1.DayOfYear() << endl;

      a1 = zDate(zDate::feb, 16, 1993);
      cout << a1 << "\t" << ((a1.IsLeapYear()) ? "Leap" : "non-Leap");
      cout << "\t" << "day of year:  " << a1.DayOfYear() << endl;

      zDate v4(zDate::Today());
      cout << "---------- Add Stuff -----------\n";
      cout << "Start => " << v4 << endl;
      cout << "Add  4 Weeks  => " << v4.AddWeeks(4) << endl;
      cout << "Sub 52 Weeks  => " << v4.AddWeeks(-52)  << endl;
      cout << "Add  2 Years  => " << v4.AddYears(2)    << endl;

      cout << flush;

      cout << "---------- Misc Stuff -----------\n";
      cout << "The date aboves' day of the month is => " << v4.Day() << endl;
      cout << "There are " << v4.DaysInMonth() << " days in this month.\n";
      cout << "This day happens to be " << v4.DayOfWeek() << " day of week" << endl;
      cout << "on the " << v4.WeekOfYear() << " week of the year," << endl;
      cout << "on the " << v4.WeekOfMonth() << " week of the month, " << endl;
      cout << "which is the "<< (int)v4.Month() << "nth month in the year.\n";
      cout << "The year alone is " << v4.Year() << endl;
      cout << "And this is the " << v4.DayOfYear() << " day of year" << endl;
      cout << "of a year with " << v4.DaysInYear() << " days in it" << endl;
      cout << "which makes exatcly " << v4.WeeksInYear() << " weeks" << endl;

      zDate birthday(zDate::jul, 16, 1973);
      cout << "The age test: i was born on " << birthday
             << " which makes me " << v4.Age(birthday) << " years old" << endl;

      zDate       D2(zDate::jul, 4, 1776);
      int         I1 = 4;

      cout << "Before: I1 = " << I1 << ",  D2 = " << D2 << endl;
      cout << "---------- Postfix '++' test -----------\n";
      cout << "Test : I1++ = " << I1++ << ",  D2++ = " << D2++ << endl;
      cout << "After: I1   = " << I1 << ",  D2   = " << D2 << endl;

      cout << "---------- Prefix '++' test -----------\n";
      cout << "Test : ++I1 = " << ++I1 << ",  ++D2 = " << ++D2 << endl;
      cout << "After:   I1 = " << I1 << ",    D2 = " << D2 << endl;

      cout << "---------- Postfix '--' test -----------\n";
      cout << "Test : I1-- = " << I1-- << ",  D2-- = " << D2-- << endl;
      cout << "After: I1   = " << I1 << ",  D2   = " << D2 << endl;

      cout << "---------- Prefix '--' test -----------\n";
      cout << "Test : --I1 = " << --I1 << ",  --D2 = " << --D2 << endl;
      cout << "After:   I1 = " << I1 << ",    D2 = " << D2 << endl;

      cout << "Last day of this year is dayno "
             << zDate(zDate::dec, 31, 1996).DayOfYear() << endl;
      cout << "Last day of prev year is dayno "
             << zDate(zDate::dec, 31, 1995).DayOfYear() << endl;

      cout << "Today the moon is " << zDate::Today().MoonPhase() << endl;

      zDate today = zDate::Today();

      cout << "DST for " << today.Year() << " starts on " << today.BeginDST()
             << " and ends on " << today.EndDST() << endl;
      cout << "Today, " << today << ", DST is "
             << (today.IsDST() ? "" : "not") << "in effect" << endl;

      zDate date1(zDate::aug, 31, 1996);
      cout << "Adding 6 months to " << date1 << " results in "
             << date1.AddMonths(6) << endl;

      zDate date2(zDate::mar, 31, 1996);
      cout << "Subtracting 1 month from " << date2 << " results in "
             << date2.AddMonths(-1) << endl;

      zDate date3(zDate::jul, 4, 1776);
      cout << "Adding 2400 months to " << date3 << " results in "
             << date3.AddMonths(2400) << endl;

      cout << "Today's day number is " << zDate::Today().DayNumber() << endl;

      zDate date4(zDate::feb, 29, 1996);
      cout << date4 << " subtract two years = " << date4.AddYears(-2) << endl;

      cout << "In 1996, DST began on " << zDate::BeginDST(1996) << endl;

      zDate date5(zDate::sep, 26, 1996);
      cout << "Moon phase on " << date5 << " was " << date5.MoonPhase() << endl;

      zDate date6(zDate::oct, 3, 1996);
      cout << date6 << " + 55 days is " << (date6 + 55) << endl;

      zDate date7(zDate::oct, 4, 1996);
      cout << date7 << " + 217 days is ";
      date7 += 217;
      cout << date7 << endl;
      date7 = zDate(zDate::oct, 4, 1996);
      cout << "Same date - (-217) days is ";
      date7 -= -217;
      cout << date7 << endl;

      cout << "For 1996, Easter is on " << zDate::Easter(1996) << endl;
}