题解 | #KiKi定义电子日历类#
KiKi定义电子日历类
https://www.nowcoder.com/practice/e4c67097cdb242d9a3f38b7cfe839396
#include <stdio.h> #include<stdlib.h> typedef struct TDate { int M; int Y; int D; }datetime,*date; //输入日期 date date_scanf() { int y,m,d; scanf("%d %d %d",&y,&m,&d); date Date = (date)malloc(sizeof(datetime)); Date->D = d; Date->M = m; Date->Y = y; return Date; } //输出日期 void date_printf(date Date) { printf("%d/",Date->D); printf("%d/",Date->M); printf("%d",Date->Y); } int main() { date Date = date_scanf(); date_printf(Date); return 0; }