C # create a simple project countdown timer by yourself,
Using System; using System. collections. generic; using System. componentModel; using System. data; using System. drawing; using System. text; using System. windows. forms; namespace date {public partial class Form1: Form {public Form1 () {InitializeComponent (); string st1 = "2008-11-4"; // the end date DateTime dt2 = System. dateTime. now; // obtain today's date DateTime dt1 = Convert. toDateTime (st1); // convert the end date type to DateTime string dateTerm = null; // try {TimeSpan ts1 = new TimeSpan (dt1.Ticks ); // convert a date to a comparable TimeSpan ts2 = new TimeSpan (dt2.Ticks); TimeSpan ts = ts1.Subtract (ts2 ). duration (); // end date minus current date // dateTerm = ts. days. toString () + "day" // + ts. hours. toString () + "Hour" // + ts. minutes. toString () + "Minute" // + ts. seconds. toString () + "second"; dateTerm = "end of project" + ts. days. toString () + "day"; // remaining time of the Project // MessageBox. show (dateTerm); label1.Text = dateTerm; // display in Label} catch {}}}}
Drag the generated .exe file to the startup Item to remind you to pull it every day.
In the C language, what is the symbol (->) and how to use it?
This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.
In the C language, what is the symbol (->) and how to use it?
This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.