i know how to solve the problem ,( add code "system("pause") in the front of "return 0" )

enter image description here

but i just don`t know what happened to the vs?

#define _CRT_SECURE_NO_WARNINGS  
#include <iostream>
#include <ctime>
#include <string> 
using namespace std;

class Date
{
public:
    Date(int, int, int, int);
    ~Date()
    {
        cout << "Thanks you !" << endl;
    }
    void print() const;
private:
    int year;
    int month;
    int day;
    int day1;
    const string Month[12] = { "January","February","March","April","May","June","July","August","September","October","November","December" };
};

Date::Date(int y = 1900, int m = 1, int d = 1, int d1 = 1)
{
    year = y;
    month = m;
    day = d;
    day1 = d1;
}

void Date::print() const
{
    cout << "DDD YYYY: " << day1 << "  " << year << endl;
    cout << "MM/DD/YYYY: " << month << "/" << day << "/" << year << endl;
    cout << Month[month - 1] << " " << day << " " << year << endl;
}

int main()
{
    time_t t;
    t = time(NULL);
    struct tm *local = localtime(&t);
    int y = local->tm_year + 1900;
    int m = local->tm_mon + 1;
    int d = local->tm_mday;
    int d1 = local->tm_yday;
    Date date(y, m, d, d1);
    date.print();
    //system("pause");

    return 0;
}

0 Answers