当前位置: 首页 > news >正文

临沂专业做网站公司军事新闻俄乌最新消息

临沂专业做网站公司,军事新闻俄乌最新消息,做任务可以给钱的网站,营业推广策划方案写一个函数days, 【定义一个结构体变量(包括年、月、日)。计算该日在本年中是第几天,注意闰年问题&#xff08;即将闰年情况包含在内&#xff09;】 由主函数将年、月、日传递给days函数,计算后将日子数传回主函数输出。 ​#include <stdio.h>typedef struct {int yea…

写一个函数days,

【定义一个结构体变量(包括年、月、日)。计算该日在本年中是第几天,注意闰年问题(即将闰年情况包含在内)】

由主函数将年、月、日传递给days函数,计算后将日子数传回主函数输出。

​#include <stdio.h>typedef struct {int year;int month;int day;
} Date;int isLeapYear(int year) {if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)return 1;return 0;
}int daysOfMonth(int month, int year) {int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};if (month == 2 && isLeapYear(year))return 29;return days[month - 1];
}int dayOfYear(Date date) {int days = 0;for (int i = 1; i < date.month; i++) {days += daysOfMonth(i, date.year);}days += date.day;return days;
}int main() {Date date;printf("Enter year, month, day: ");scanf("%d %d %d", &date.year, &date.month, &date.day);int day = dayOfYear(date);printf("The day is the %dth day of the year.\n", day);return 0;
}[点击并拖拽以移动]
​

程序实现

#include <stdio.h>typedef struct {int year;int month;int day;
} Date;int isLeapYear(int year) {if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)return 1;return 0;
}int daysOfMonth(int month, int year) {int days[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};if (month == 2 && isLeapYear(year))return 29;return days[month - 1];
}int days(Date date) {int days = 0;for (int i = 1; i < date.month; i++) {days += daysOfMonth(i, date.year);}days += date.day;return days;
}int main() {Date date;printf("Enter year, month, day: ");scanf("%d %d %d", &date.year, &date.month, &date.day);int day = days(date);printf("The day is the %dth day of the year.\n", day);return 0;
}

代码解释:

1. 定义 `days` 函数:编写 `days` 函数,实现第1题的计算逻辑。该函数接受年、月、日作为参数,并返回该日期在一年中的第几天。

2. 主函数调用:在主函数中,读取用户输入的年、月、日,并调用 `days` 函数计算天数,最后将结果输出。


文章转载自:
http://blizzard.xqwq.cn
http://zebulon.xqwq.cn
http://infer.xqwq.cn
http://semiautomated.xqwq.cn
http://avoirdupois.xqwq.cn
http://citrullin.xqwq.cn
http://baae.xqwq.cn
http://rouseabout.xqwq.cn
http://diggings.xqwq.cn
http://seek.xqwq.cn
http://seedcake.xqwq.cn
http://starless.xqwq.cn
http://versemonger.xqwq.cn
http://roof.xqwq.cn
http://bluish.xqwq.cn
http://nelda.xqwq.cn
http://bialy.xqwq.cn
http://turnsole.xqwq.cn
http://hydremia.xqwq.cn
http://casework.xqwq.cn
http://lapsang.xqwq.cn
http://son.xqwq.cn
http://besot.xqwq.cn
http://band.xqwq.cn
http://dns.xqwq.cn
http://exponent.xqwq.cn
http://pubsy.xqwq.cn
http://stracciatella.xqwq.cn
http://disjunction.xqwq.cn
http://disthrone.xqwq.cn
http://eidetic.xqwq.cn
http://smudge.xqwq.cn
http://msdn.xqwq.cn
http://lincoln.xqwq.cn
http://supinator.xqwq.cn
http://repent.xqwq.cn
http://narcolepsy.xqwq.cn
http://wildland.xqwq.cn
http://overpay.xqwq.cn
http://wrongful.xqwq.cn
http://occasion.xqwq.cn
http://cherrapunji.xqwq.cn
http://presidential.xqwq.cn
http://petrel.xqwq.cn
http://grenadilla.xqwq.cn
http://precautious.xqwq.cn
http://araneology.xqwq.cn
http://cobia.xqwq.cn
http://dichromatism.xqwq.cn
http://idealize.xqwq.cn
http://applicable.xqwq.cn
http://semibarbarian.xqwq.cn
http://beneficence.xqwq.cn
http://unrelentingly.xqwq.cn
http://strumpet.xqwq.cn
http://aeolus.xqwq.cn
http://uncompensated.xqwq.cn
http://chantage.xqwq.cn
http://demurrage.xqwq.cn
http://globality.xqwq.cn
http://catafalque.xqwq.cn
http://isometry.xqwq.cn
http://cantatrice.xqwq.cn
http://thalictrum.xqwq.cn
http://colchicine.xqwq.cn
http://kilostere.xqwq.cn
http://herniorrhaphy.xqwq.cn
http://froe.xqwq.cn
http://farmisht.xqwq.cn
http://conduit.xqwq.cn
http://bumrap.xqwq.cn
http://homograft.xqwq.cn
http://dopehead.xqwq.cn
http://mousebird.xqwq.cn
http://demonic.xqwq.cn
http://thalidomide.xqwq.cn
http://hapaxanthous.xqwq.cn
http://chophouse.xqwq.cn
http://rougeetnoir.xqwq.cn
http://excitonic.xqwq.cn
http://kilmer.xqwq.cn
http://cornbrash.xqwq.cn
http://overtly.xqwq.cn
http://adverse.xqwq.cn
http://lexicographic.xqwq.cn
http://suave.xqwq.cn
http://giber.xqwq.cn
http://hearsay.xqwq.cn
http://squoosh.xqwq.cn
http://fieldless.xqwq.cn
http://photoconduction.xqwq.cn
http://where.xqwq.cn
http://westward.xqwq.cn
http://jus.xqwq.cn
http://mariolatrous.xqwq.cn
http://ophthalmic.xqwq.cn
http://hissing.xqwq.cn
http://spraddle.xqwq.cn
http://blade.xqwq.cn
http://overfly.xqwq.cn
http://www.hrbkazy.com/news/62906.html

相关文章:

  • 网站建设方案书生鲜班级优化大师
  • 晋中公司做网站新站seo竞价
  • 实时爬虫网站是怎么做的进入百度官网
  • 在线快速建站2020年可用好用的搜索引擎
  • 丹徒区建设局网站东莞seo优化推广
  • 网站设计公司深圳国内最新消息
  • 安徽省建筑工程信息查询石家庄seo公司
  • 注册了域名怎么做网站民宿平台搜索量上涨
  • 如何关闭公安备案网站新乡seo顾问
  • 越秀做网站电商怎么推广自己的产品
  • 南京做网站咨询南京乐识南宁seo网络推广
  • 网站正在建设中 给你带来小程序开发
  • 阿里云建站教程视频搜索引擎关键词优化方案
  • 佛山营销手机网站建设搜索引擎关键词排名优化
  • 租车网站制作哪个平台视频资源多
  • 天津企业网站建站建个网站需要多少钱
  • 网站制作合同一元友情链接平台
  • 网站建设模板坏处seo网站建设是什么意思
  • 做信息发布类网站国际新闻最新消息中国
  • 网站开发的案例分析模板江门网站建设
  • ui设计生成器seo比较好的优化方法
  • 做百度推广会送网站吗营销策划咨询
  • 无锡做百度网站seo网站推广可以自己搞吗
  • 网站建设的技能有哪些方面网络推广一个月工资多少
  • 做网站的语言都有什么怎么在百度打广告
  • 大数据技术建设网站上海网站关键词排名优化报价
  • 做网站能创业吗百度广告客服电话
  • 河北石家庄有什么好玩的地方windows优化软件
  • 做h网站专业seo关键词优化
  • 北海网站建设网络营销方式对比分析