定义一个日期结构类型(包括年,月,日)设计函数对2个日期型变量进行输入输出
2个回答
展开全部
struct date
{
int month;
int day;
int year;
} today,yestaday;
int y,m,d;
scanf("please input the year:%i",&.y);
scanf("please input the month:%i",&.m);
scanf("please input the day:%i",&.d);
today->month = m;
today->day = d;
today->year =y;
prinf("the year is :%i,the month is :%i,the day is :%i",today->year,today->month,today->day);
我现在学objective-c呢,凭记忆写的c,试试行不行。
{
int month;
int day;
int year;
} today,yestaday;
int y,m,d;
scanf("please input the year:%i",&.y);
scanf("please input the month:%i",&.m);
scanf("please input the day:%i",&.d);
today->month = m;
today->day = d;
today->year =y;
prinf("the year is :%i,the month is :%i,the day is :%i",today->year,today->month,today->day);
我现在学objective-c呢,凭记忆写的c,试试行不行。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
利用time.h中的struct tm 和一些函数可以实现了,手机上的,要的话追问下,呵呵
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询