电子万年历:用c语言设计一个年历系统,功能要求: (1)输入任一年将显示出该年的所有月份日期,对应的星
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <time.h>
int leap(int year )
{
if ((year %4 == 0) && (year % 100 != 0)
|| (year % 400 == 0))
{
return 1;
}
return 0;
}
void show(int year,int month)
{
const char month_str[][4]={"","jan","feb","mar","apl",
"may","jun","jul","aug","sep","oct","nov","dec"};
const int month_day[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i,j,wdays,mdays,days;
int count=0;
for(i=1,days=0;i<year;i++)
{
if(leap(i))
{
days += 366;
}
else
{
days += 365;
}
}
for(i=1;i<month;i++)
{
if(i==2 && leap(year))
{
days+=29;
}
else
{
days+=month_day[i];
}
}
printf("\n----------------------------\n");
printf(" %s %d\n",month_str[month],month);
printf(" sun mon tue wed thu fri sat\n");
wdays = days % 7;
for( j = 0; j <= wdays; j++)
{
if(wdays==6) break;
for( i = 0; i < 4; i++)
{
printf(" ");
}
count++;
}
if(month == 2 && leap(year))
{
mdays=29;
}
else
{
mdays= month_day[month];
}
for(i=1;i<=mdays;i++)
{
if( i > 1 && count % 7 == 0 )
{
printf("\n");
}
printf("%4d",i);
count++;
}
printf("\n----------------------------\n");
}
main()
{
int year,month;
printf("input the year:");
scanf("%d",&year);
printf("the calendar of the year %d.",year);
printf("\n----------------------------\n");
for(month=1;month<=12;month++)
show(year,month);
system("pause");
}
-
佚名2024-05-29 12:12:48
问想用c#设计一个万年历软件,能显示对应的阴历时间,特殊节气,特殊节日等,求大神解答
答以前帮别人做的 比你要求的功能还要多一点。如果你的vs版本是 2010以前的的话,用记事本打开notecalendar.csproj修改 toolsversio...
-
佚名2024-05-29 08:00:00
问求用vb做万年历 要求输入一个日期 得到星期节日星座节气
答分数太少了,呵呵,呵呵另外的农历,是更好地做 用的printf打印功能目录,切换来完成调用子函数很多次了,再加上大循环 日历显示,这是相对简单的,是计算的一年的...
-
佚名2024-05-29 08:00:00
问想用c#设计一个万年历软件,能显示对应的阴历时间,特殊节气,特殊节日等,求大神解答
答以前帮别人做的 比你要求的功能还要多一点。如果你的vs版本是 2010以前的的话,用记事本打开notecalendar.csproj修改 toolsversio...
-
佚名2024-05-29 08:00:00
问用c语言编写一个万年历系统
答#include<stdio.h> #define mon 1#define tues 2#define wed 3#define thur ...
-
佚名2024-05-29 08:00:00
问万年历查询程序(c++) 1给定的日期显示该日是星期几 2输入的月份以日历形式显示本月各日对应星期
答有个原来写的打印月份:都是比较普通的语句#include <iostream>using namespace std;int main(){ int...
-
佚名2024-05-29 08:00:00
问用c语言编写万年历。
答#include "stdio.h"void main(){ long days; int j,i,s,mdays,flag,yy,y; printf("...
-
佚名2024-05-29 08:00:00
问单片机万年历的怎样设计的?c语言版
答分析:硬件:需要设计89c51+lcd1602,一般有现成的;再采用 spi 三线接口设计ds1302,一般也有类似的;估计还需要设计键盘,输入时间。程序:功能...
-
佚名2024-05-29 08:00:00
问【难】用c语言打印一个万年历
答#include <iostream.h>#include <time.h>#include <stdio.h>#include <st...
-
佚名2024-05-29 08:00:00
问基于单片机的电子万年历设计,能够显示日期,时间,温度。
答已发,chenxianen@vip.qq.com 电路图我是protues画的,管脚和程序有点不对应,你如果需要就追问。只要修改一下前面的define就可以了。...
-
佚名2024-05-29 08:00:00
问设有一个档案管理系统,要求用户输入以年月表示的日期。假设日期限定在1990年1月~2049年12月。急急急,跪
答public static boolean checkdatevalidness(string date){int len=date.length();//字符...
风水
起名
网名
- 1 黄山烟网名
- 2 qq网名和说说
- 3 帮我起优雅有气质网名
- 4 两人网名古文
- 5 与蛋壳有关的昵称
- 6 qq邮箱昵称修改不了
- 7 游戏昵称清2字
- 8 qq昵称女生带符号4字
- 9 sylvia的昵称搭配
- 10 怎么查看自己微博昵称用多久了
说说
- 1 qq个性签名红色
- 2 流星花园个性签名
- 3 lol好友个性签名
- 4 qq签名 不让人评论
- 5 旅游心情说说感悟生活
- 6 想吃胖的说说
- 7 嘴贱的人说说
- 8 大热天没水的说说
- 9 一个简单的依靠说说
- 10 我不想跟你分手说说