c语言设计一个万年历的需求分析,万年历设计报告
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
char* month_str[]={"January","February","March","April","May","June","July","August","September","October","November","December"};
char* week[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
int IsLeapYear(int year) /*find out the year is leap year or not*/
{
if((year%4==0&&year%100!=0)||(year%400==0))
return 1;
else
return 0;
}
int month_day(int year,int month)
{
int mon_day[]={31,28,31,30,31,30,31,31,30,31,30,31};
if(IsLeapYear(year)&&month==2)
return 29;
else
return(mon_day[month-1]);
}
int DaySearch(int year,int month,int day) /*search what day this day is*/
{
int c=0;
float s;
int m;
for(m=1;m
c=c+month_day(year,m);
c=c+day;
s=year-1+(float)(year-1)/4+(float)(year-1)/100+(float)(year-1)/400-40+c;
return ((int)s%7);
}
int PrintAllYear(int year)/*print the all year*/
{
int temp;
int i,j;
printf("\n\n%d Calander\n",year);
for(i=1;i<=12;i++)
{
printf("\n\n%s(%d)\n",month_str[i-1],i);
printf("0 1 2 3 4 5 6 \n");
printf("S M T W T F S \n\n");
temp=DaySearch(year,i,1);
for(j=1;j<=month_day(year,i)+temp;j++)
{
if(j-temp<=0)
printf(" ");
else if(j-temp<10)
printf("%d ",j-temp);
else
printf("%d ",j-temp);
if(j%7==0)
printf("\n");
}
}
return 0;
}
int main()
{
int option,da;
char ch;
int year,month,day;
printf("Copyright @ 2005 TianQian All rights reserved!:):):)");
printf("\n\nWelcome to use the WanNianLi system!\n");
while(1)
{
printf("\nPlease select the service you need:\n");
printf("\n1 Search what day the day is");
printf("\n2 Search whether the year is leap year or not");
printf("\n3 Print the calander of the whole year");
printf("\n4 Exit\n");
scanf("%d",&option);
switch(option)
{
case 1:
while(1)
{
printf("\nPlease input the year,month and day(XXXX,XX,XX):");
scanf("%d,%d,%d,%c",&year,&month,&day);
da=DaySearch(year,month,day);
printf("\n%d-%d-%d is %s,do you want to continue?(Y/N)",year,month,day,week[da]);
fflush(stdin);
scanf("%c",&ch);
if(ch=='N'||ch=='n')
break;
}
break;
case 2:
while(1)
{
printf("\nPlease input the year which needs searched?(XXXX)");
scanf("%d",&year);
if(IsLeapYear(year))
printf("\n%d is Leap year,do you want to continue?(Y/N)",year);
else
printf("\n%d is not Leap year,do you want to continue(Y/N)?",year);
fflush(stdin);
scanf("%c",&ch);
if(ch=='N'||ch=='n')
break;
}
break;
case 3:
while(1)
{
printf("\nPlease input the year which needs printed(XXXX)");
scanf("%d",&year);
PrintAllYear(year);
printf("\nDo you want to continue to print(Y/N)?");
fflush(stdin);
scanf("%c",&ch);
if(ch=='N'||ch=='n')
break;
}
break;
case 4:
fflush(stdin);
printf("Are you sure?(Y/N)");
scanf("%c",&ch);
if(ch=='Y'||ch=='y')
exit(0);
break;
default:
printf("\nError:Sorry,there is no this service now!\n");
break;
}
}
return 0;
}
c语言设计一个万年历的需求分析,万年历设计报告相关推荐
- C++:设计一个学生学籍管理系统,设计相关信息,并执行一些计算和文件操作
版本更新12.28修复了全部已知bug 1.修复了回显缺失的bug 2.修复了变量导致结果不正确的bug 3.修复了数据冲突的bug 4.修复了文件读写未关闭的bug 题目: 设计一个学生学籍管理系 ...
- 怎样设计一个好玩的游戏——游戏设计的艺术
前言: 一个好玩的游戏,就是要让玩家在玩游戏的过程中感到愉快的游戏体验.游戏品质一般可以分为三个层次:普通.精品.经典. 仅仅要游戏能赚钱的好游戏可算是精品游戏,而经典的游戏,必定有深厚的游戏内涵,甚 ...
- c语言电子万年历大作业,C语言实现一个简单的电子万年历
最近帮朋友做一些C语言的练习题,期间遇到了个比较有意思的题目,意在考察模块化程序设计,大致要求如下: 电子万年历: 1.编写函数int isleapyear(int year);判某年是否为闰年,如该 ...
- 日历公历农历C语言大作业,C语言编写一个带农历的万年历
满意答案 kkdpzl 2013.04.03 采纳率:51% 等级:12 已帮助:9656人 没有农历的如下: #include #include #include #include int l ...
- MySQL设计一个图书馆数据库_请设计一个图书馆数据库
匿名用户 1级 2014-05-05 回答 原文出处]现代图书情报技术 京 200206 4-6 G9 图书馆学.信息科学.资料工作 200301 基于UML的高校图书馆管理系统 The Applic ...
- 计算机网络设计一个网络游戏,计算机网络编程课程设计-- 猜数游戏.doc
软 件 学 院 课程设计报告书 课程名称 计算机网络编程课程设计 设计题目 猜数游戏 专业班级 学 号 姓 名 指导教师 2011 年 12 月 目录 1 设计时间1 2 设计目的1 3 设计任务1 ...
- java 设计一个动物类_Java课程设计(动物换位)
[实例简介] 是一个关于Java课程设计的一个游戏,这是一个动物换位的游戏,是在前人的基础上改进的.不好请见谅! [实例截图] [核心代码] 112df6fb-1189-4bc0-a501-6dd58 ...
- 用html设计一个logo页面_如何设计一个Logo?——Bobu Africa旅行品牌Logo设计
负空间Logo听起来很牛逼,但是到底要怎么做? Bobu Africa是一家位于肯尼亚,主营泛非洲奢侈旅行与工艺品销售的品牌.Africa当然指的是其主要业务范围--非洲.Bobu则是猴面包树Baob ...
- 用户拉新是去哪儿现在的重要战略目标,结合近期大火的“百万答题”等热门活动,给去哪儿设计一个拉新活动,设计内容要包括:活动主题、活动所依附的产品基本形态,产品核心功能点。请你详
活动主题:开学季,去哪儿? 活动所依附的产品基本形态:去哪儿APP&小程序 策划详情 拉新.促活.转化.复购,是4个用户增长的关键点.在本题中,只讲拉新这一部分. 首先,对代金券的类型进行设计 ...
最新文章
- How does framework require TechnicalInfo.js
- “CV_RGB2BGR”: 未声明的标识符
- 全排列及相关扩展算法(二)——求字典序下一组排列及全排列算法
- 霓虹促销电商设计,购买欲冲击视觉
- ExtJs - grid 合并单元格 跨行跨列
- 2021全国大学生电子设计大赛题目汇总
- Java全网最全面试题(2022年VIP典藏版)
- java繁简转换_「繁简体转换」Java中文繁简体转换工具 - seo实验室
- OpenGl运行窗口出现纯白色
- rap格式鸿蒙,你,想要成为rap star吗?
- 【APICloud系列|15】上架ios应用到苹果应用市场总结
- c++实现种子填充算法与扫描线算法
- 帝国cms小程序端源码
- 详解randn函数及 randn('state')
- 一组图片看完“自动驾驶”发展史
- 四大项目方合作解锁Halo 2,助力Web3发展
- Android 通过蒲公英pgyer的接口 Service 实现带进度下载App 通知栏显示 在线更新 自动更新Demo
- IBM V7000存储配置
- 四川大专计算机科学与技术,四川省计算机科学与技术专业主要课程有哪些
- python——replace函数
热门文章
- DHCP服务器-配置
- python3 32位_Python 3.6.8软件安装教程
- python 抓包 上传 文件_Python接口测试文件上传实例解析
- linux搭建springBoot环境,SpringBoot Linux服务化部署
- sap 打印预览界面点击打印时记录打印次数_SAP打印机设置
- 哪些名人在学python_盘点计算机界十位顶级人物,看看你认识几个?
- 机器学习之Fisher线性分类器实现样本分类
- 量化投资之定投,无脑却收益还不错,记得周三来
- php ayui表格,layui表格使用
- 思维导图一定要用计算机来完成吗,计算机绘制思维导图有什么优势