记录下码子

 # define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
# include <stdlib.h> int days(int month)
{
int day;
switch (month)
{
case :
day = ; //1月天数
break;
case :
day = +; //1+2月天数
break;
case :
day = + + ; //1+2+3月天数
break;
case :
day = + + + ;
break;
case :
day = + + + + ;
break;
case :
day = + + + + + ;
break;
case :
day = ++ + + + + ;
break;
case :
day = + + + + + + + ;
break;
case :
day = ++ + + + + + + ;
break;
case :
day =+ + + + + + + + + ;
break;
case :
day = ++ + + + + + + + + ;
break;
case :
day = + + + + + + + + + + + ; //12个月的天数
break;
}
return day;
} int main()
{
int month, day,days1;
int month_2, day_2,days2;
int result;
printf("请输入一个日期\n");
scanf("%d %d", &month, &day); printf("请输入第二个日期\n");
scanf("%d %d", &month_2, &day_2); days1 = days(month) + day; //计算第一个日期的天数
days2 = days(month_2) + day_2; //计算第二个日期的天数
//printf("%d %d", days1, days2); //大的天数减去小的天数
if (days1 > days2)
{
result = days1 - days2;
}
else
{
result = days2 - days1;
}
printf("\n");
printf("%d月%d日和%d月%d日间隔%d天\n", month, day, month_2, day_2,result);
system("pause");
return ;
}

运行结果:

最新文章

  1. tomcat集群实例重复执行
  2. [HTML5]HTML语义(Semantics)
  3. 2.每人自己建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别。答题人:张立鹏
  4. linux中使用软链接时出现 too many levels of symbolic links
  5. CSS_网站配色参考方案
  6. MES项目中出现的一个事务嵌套的使用场景
  7. 数据(数组,json)的处理
  8. 自定义key解决zabbix端口监听取值不准确的问题
  9. Android launcher3 开发初始篇
  10. 静态页面调试JS出现跨域问题
  11. [Luogu3768]简单的数学题
  12. nginx配置备份
  13. hdu 4486 Pen Counts
  14. 将句子表示为向量(下):基于监督学习的句子表示学习(sentence embedding)
  15. 汇编语言调用Linux系统调用read和write
  16. JAVA 系统变量之System.getenv()和System.getProperty() 用法
  17. NLayerAppV3-Infrastructure(基础结构层)的Data部分和Application(应用层)
  18. Object C学习笔记4-内存管理
  19. 编译geth报错的解决方法 make: *** [geth] 错误 1
  20. Java中的static关键字的用法

热门文章

  1. Fence(codeforces 232D)
  2. .NET结束外部进程 C#结束外部进程
  3. aspx生成静态页面html 例子
  4. springboot 邮件
  5. Qt5网络请求使用及WebRequest函数
  6. Linux日志审计
  7. Codeforces Gym100971 F.Two Points (IX Samara Regional Intercollegiate Programming Contest Russia, Samara, March 13)
  8. sprintf 心得
  9. Codeforces 761D Dasha and Very Difficult Problem(贪心)
  10. ssh免秘钥登陆实现