Home > Back-end >  Everyone who taught me, genuflect is begged just learning, not really!!
Everyone who taught me, genuflect is begged just learning, not really!!

Time:09-17

, I see this I received, suffocation to no, how do I answer, in years, appears to be simple, but in the eyes of students with poor grades to proposition is!
C + + solutions, thanks for your bosses! _ () _)) _

CodePudding user response:

Has the certain difficulty,,,,,,,

CodePudding user response:

1. The TDateTime DateTime=Time ();
AnsiString today=TimeToString (DateTime);//output 9:20:50

2. The AnsiString today=TimeToString (Now ());//output 9:20:50

3. The AnsiString today=FormatDateTime (" MM - dd yyyy - HH: MM: ss ", Now ());
//FormatDateTime output format () function can be set a time
//http://www.docin.com/p-1825776224.html

4. The AnsiString today=YearOf (Now ());//get the current year, the output 2019
AnsiString today=MonthOf (Now ());//get the current month, output 2
AnsiString today=DayOf (Now ());//get the current, output 28
AnsiString today=HourOf (Now ());//get the current hour, output 9
AnsiString today=MinuteOf (Now ());//get the current year, the output of 20
AnsiString today=SecondOf (Now ());//get the current year, the output of 50

CodePudding user response:

Really cry!!!!! Don't!!!!!

CodePudding user response:

reference 1st floor ooolinux response:
has the certain difficulty,,,,,,,

Really don't

CodePudding user response:

refer to the second floor hyaaaafighting response:
1. TDateTime DateTime=Time ();
AnsiString today=TimeToString (DateTime);//output 9:20:50

2. The AnsiString today=TimeToString (Now ());//output 9:20:50

3. The AnsiString today=FormatDateTime (" MM - dd yyyy - HH: MM: ss ", Now ());
//FormatDateTime output format () function can be set a time
//http://www.docin.com/p-1825776224.html

4. The AnsiString today=YearOf (Now ());//get the current year, the output 2019
AnsiString today=MonthOf (Now ());//get the current month, output 2
AnsiString today=DayOf (Now ());//get the current, output 28
AnsiString today=HourOf (Now ());//get the current hour, output 9
AnsiString today=MinuteOf (Now ());//get the current year, the output of 20
AnsiString today=SecondOf (Now ());//get the current year, the output of 50

Big!!!!!! What about several q

CodePudding user response:

Write a class Time, nothing more than
Several constructors (can use parameters default)
A copy constructor (member variables without pointer or resources can not write, the compiler can be generated by default)
Several getXXX function (, minutes, seconds)
Several setXXX function (, minutes, seconds)
A number of display function
Operator=operator overloading function (member variables without pointer or resources can not write, the compiler can be generated by default)
Other operator overloading function, such as operator++, operator++ (int)
Other functions, such as add, subtract several hours, minutes, seconds (int n) function

The Date class is similar,

CodePudding user response:

According to the lunar calendar date, is more difficult, involves certain algorithm,

CodePudding user response:

Can write plus and minus 1 hour, 1 minutes, 1 second function, and then n hours, minutes and seconds of function calls it,

CodePudding user response:

refer to the eighth floor ooolinux response:
can write plus, minus 1 hour, 1 minutes, 1 second function, and then n hours, minutes and seconds of function calls it,

Cry?? , bosses, I write not to come out, some didn't learn? _?

CodePudding user response:

Reading books, watching class how to write,
  • Related