c++ - days=dateDiff(mindate,maxdate); 是什么意思
阿神
阿神 2017-04-17 12:57:54
0
1
858
int main()  //这里的int是指返回值的类型必须为int类型的
{     
    //  int isPrime(int year);  
    int dateDiff(struct date mindate,struct date maxdate);  //定义了一个日期参数,以及两个形参初始日期和终止日期
    struct date mindate,maxdate;  //初始化mindate,maxdate,且mindate为日期的上限,maxdate为日期的下限
    int days;  
      
    printf("请输入起始日期:");  
    scanf("%i-%i-%i",&mindate.year,&mindate.month,&mindate.day);  
    printf("请输入终止日期:");  
    scanf("%i-%i-%i",&maxdate.year,&maxdate.month,&maxdate.day);  
      
    days=dateDiff(mindate,maxdate);   
    printf("这两个日期相差的天数为:%d\n",days);  
    return 0;  
}

谁能解释一下

阿神
阿神

闭关修行中......

reply all(1)
Peter_Zhu

First declare a function, then read two dates from the standard input, and call the function to calculate the number of days difference between the two dates

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!