Home > Back-end >  Hurry please. Write a program to month/day/year format accept user input date, and in the date forma
Hurry please. Write a program to month/day/year format accept user input date, and in the date forma

Time:12-11

Hurry please. Write a program to month/day/year format accept user input date, and in the date format to display its
Enter a date (yyyy/mm/dd) : 2019/06/02
The output is:
You enter the date: June 9, 02201, Tuesday

CodePudding user response:

Write about himself first, the problem is not difficult

CodePudding user response:


 
#include
#include
Int main () {
Struct tm tm={};
Char buff [64].
Printf (" Enter a date (yyyy/mm/dd) : ");
The scanf (" % d % * c * c % % d % d ", & amp; Tm tm_year, & amp; Tm tm_mon, & amp; Tm. Tm_mday);
//in the tm, begin from 1900, on a scale of 0-11
Tm. Tm_year -=1900;
Tm. Tm_mon -=1;
//a switch back and forth, the format of the tm on the
Time_t time=mktime (& amp; Tm);
Tm=* localtime (& amp; Time);

Strftime (buff, sizeof (buff), "% % % % d, b Y, A", & amp; Tm);
Puts (buff);
return 0;
}
  • Related