用C程序编译定义一个结构变量(包括年、月、日)。计算该日在本年中是第几天,注意闰年问题

[复制链接]
查看11 | 回复1 | 2008-6-21 15:20:58 | 显示全部楼层 |阅读模式
#include"stdio.h"struct date{ int year; int month; int day;}; int Day(struct date *p){ int a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; int b[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; int i,n=0,m=p->year; if((m%4==0&&m%100!=0)||(m%400==0)) {for(i=1;imonth;i++) n+=b;n+=p->day;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行