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

淘客cms网站建设教程免费网络营销软件

淘客cms网站建设教程,免费网络营销软件,七牛链接wordpress,建立网站需要哪些步骤文章目录C语言中结构体在解题中的应用1、结构体之时间设计2、结构体之成绩记录3、结构体之成绩统计2C语言中结构体在解题中的应用 1、结构体之时间设计 题目描述 定义一个结构体变量(包括年、月、日)。计算该日在本年中是第几天,注意闰年问…

文章目录

  • C语言中结构体在解题中的应用
    • 1、结构体之时间设计
    • 2、结构体之成绩记录
    • 3、结构体之成绩统计2

C语言中结构体在解题中的应用

1、结构体之时间设计


题目描述

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

输入格式

年月日

输出格式

当年第几天

样例输入

2000 12 31

样例输出

366

AC代码(C语言)

#include<stdio.h>
#include<string.h>
typedef struct {int year;int month;int day;
}TIME;
int isLeapYear(int year){//能被400整除,或者能被4整除但不能被100整除的年份为闰年if(year%400==0||year%4==0&&year%100!=0)return 1;return 0;
}
int main(){TIME time;int result=0;scanf("%d%d%d",&time.year,&time.month,&time.day);switch (time.month){case 1:result=time.day;       break;case 2:result=time.day+31;       break;case 3:result=time.day+31+28;       break;case 4:result=time.day+31+28+31;       break;case 5:result=time.day+31+28+31+30;       break;case 6:result=time.day+31+28+31+30+31;       break;case 7:result=time.day+31+28+31+30+31+30;       break;case 8:result=time.day+31+28+31+30+31+30+31;       break;case 9:result=time.day+31+28+31+30+31+30+31+31;       break;case 10:result=time.day+31+28+31+30+31+30+31+31+30;       break;case 11:result=time.day+31+28+31+30+31+30+31+31+30+31;       break;case 12:result=time.day+31+28+31+30+31+30+31+31+30+31+30;       break;default:break;}if(isLeapYear(time.year)) result++;printf("%d\n",result);return 0;
}

2、结构体之成绩记录


题目描述

现有有N个学生的数据记录,每个记录包括学号、姓名、三科成绩。 编写一个函数input,用来输入一个学生的数据记录。 编写一个函数print,打印一个学生的数据记录。 在主函数调用这两个函数,读取N条记录输入,再按要求输出。 N<100

输入格式

学生数量N占一行 每个学生的学号、姓名、三科成绩占一行,空格分开。

输出格式

每个学生的学号、姓名、三科成绩占一行,逗号分开。

样例输入

2
a100 clang 70 80 90
b200 dotcpp 90 85 75

样例输出

a100,clang,70,80,90
b200,dotcpp,90,85,75

AC代码(C语言)

#include<stdio.h>
#include<string.h>
typedef struct {char number[20];//学号char name[20];//姓名int math;//数学成绩int english;//英语成绩int chinese;//语文成绩
}Student;
Student students[105];//创建数组用来存放学生
void input(int n){for(int i=0;i<n;i++){scanf("%s%s%d%d%d",students[i].number,students[i].name,&students[i].math,&students[i].english,&students[i].chinese);}
}
void Output(int n){for(int i=0;i<n;i++){printf("%s,%s,%d,%d,%d\n",students[i].number,students[i].name,students[i].math,students[i].english,students[i].chinese);}
}
int main(){int n;scanf("%d",&n);input(n);Output(n);return 0;
}

3、结构体之成绩统计2


题目描述

有N个学生,每个学生的数据包括学号、姓名、3门课的成绩,从键盘输入N个学生的数据,要求打印出3门课的总平均成绩,以及最高分的学生的数据(包括学号、姓名、3门课成绩)

输入格式

学生数量N占一行每个学生的学号、姓名、三科成绩占一行,空格分开。

输出格式

各门课的平均成绩 最高分的学生的数据(包括学号、姓名、3门课成绩)

样例输入

2
1 blue 90 80 70
b clan 80 70 60

样例输出

85 75 65
1 blue 90 80 70

AC代码(C语言)


#include<stdio.h>
#include<string.h>
typedef struct {char number[20];//学号char name[20];//姓名int math;//数学成绩int english;//英语成绩int chinese;//语文成绩int total;//总分
}Student;
Student students[105];
//各科平均成绩
int aveMath,aveEnglish,aveChinese,sumMath=0,sumEnglish=0,sumChinese=0;void calcuAve(int n){for(int i=0;i<n;i++){scanf("%s%s%d%d%d",students[i].number,students[i].name,&students[i].math,&students[i].english,&students[i].chinese);students[i].total=students[i].math+students[i].english+students[i].chinese;sumMath+=students[i].math;//各个学生单科成绩之和sumEnglish+=students[i].english;sumChinese+=students[i].chinese;}aveMath=sumMath/n;//求平均成绩aveEnglish=sumEnglish/n;aveChinese=sumChinese/n;
}
int main(){int n;scanf("%d",&n);calcuAve(n);int max=0;printf("%d %d %d\n",aveMath,aveEnglish,aveChinese);for(int i=0;i<n;i++){//求最高成绩的学生if(students[i].total>students[max].total) max=i;}printf("%s %s %d %d %d\n",students[max].number,students[max].name,students[max].math,students[max].english,students[max].chinese);return 0;
}

文章转载自:
http://oophyte.yrpg.cn
http://dermatoid.yrpg.cn
http://katalysis.yrpg.cn
http://nauseating.yrpg.cn
http://melilite.yrpg.cn
http://jodie.yrpg.cn
http://nice.yrpg.cn
http://superincumbent.yrpg.cn
http://disturbed.yrpg.cn
http://cavitate.yrpg.cn
http://ghastliness.yrpg.cn
http://neglected.yrpg.cn
http://clupeoid.yrpg.cn
http://palearctic.yrpg.cn
http://liftboy.yrpg.cn
http://bones.yrpg.cn
http://sep.yrpg.cn
http://poh.yrpg.cn
http://bdsc.yrpg.cn
http://donative.yrpg.cn
http://invaginate.yrpg.cn
http://approbate.yrpg.cn
http://pcmcia.yrpg.cn
http://fretwork.yrpg.cn
http://truckdriver.yrpg.cn
http://aftermarket.yrpg.cn
http://initiatress.yrpg.cn
http://unique.yrpg.cn
http://extramolecular.yrpg.cn
http://beltway.yrpg.cn
http://lt.yrpg.cn
http://megohm.yrpg.cn
http://basaltoid.yrpg.cn
http://ametoecious.yrpg.cn
http://weisswurst.yrpg.cn
http://soliloquist.yrpg.cn
http://multilevel.yrpg.cn
http://ostiole.yrpg.cn
http://clave.yrpg.cn
http://ocean.yrpg.cn
http://objective.yrpg.cn
http://misanthropic.yrpg.cn
http://actinian.yrpg.cn
http://outlier.yrpg.cn
http://plug.yrpg.cn
http://thong.yrpg.cn
http://aboil.yrpg.cn
http://aberdonian.yrpg.cn
http://crawler.yrpg.cn
http://insphere.yrpg.cn
http://tyg.yrpg.cn
http://doz.yrpg.cn
http://opal.yrpg.cn
http://rupicolous.yrpg.cn
http://alcahest.yrpg.cn
http://diagrid.yrpg.cn
http://genova.yrpg.cn
http://triptich.yrpg.cn
http://menstrual.yrpg.cn
http://licentious.yrpg.cn
http://salacious.yrpg.cn
http://eurovision.yrpg.cn
http://ruble.yrpg.cn
http://clairaudient.yrpg.cn
http://oiltight.yrpg.cn
http://honey.yrpg.cn
http://nonionic.yrpg.cn
http://epileptiform.yrpg.cn
http://carlist.yrpg.cn
http://inhumorously.yrpg.cn
http://yippee.yrpg.cn
http://cacm.yrpg.cn
http://anapurna.yrpg.cn
http://responsion.yrpg.cn
http://sofar.yrpg.cn
http://shirt.yrpg.cn
http://agglutinability.yrpg.cn
http://kaoline.yrpg.cn
http://atremble.yrpg.cn
http://ladylike.yrpg.cn
http://practicer.yrpg.cn
http://dassie.yrpg.cn
http://travelled.yrpg.cn
http://perioeci.yrpg.cn
http://multiversity.yrpg.cn
http://yardarm.yrpg.cn
http://alloimmune.yrpg.cn
http://figured.yrpg.cn
http://rotoscythe.yrpg.cn
http://phytoecology.yrpg.cn
http://volumetric.yrpg.cn
http://agranulocytosis.yrpg.cn
http://jagger.yrpg.cn
http://olfactive.yrpg.cn
http://telosynapsis.yrpg.cn
http://computational.yrpg.cn
http://sidearm.yrpg.cn
http://isoeugenol.yrpg.cn
http://morphogeny.yrpg.cn
http://inexhaustible.yrpg.cn
http://www.dt0577.cn/news/58946.html

相关文章:

  • 专业做网站方案seo标题优化导师咨询
  • 成都那家网站做的好泽成杭州seo网站推广排名
  • 深圳建设交易网站网站整体优化
  • 腾讯云买域名网站页面seo
  • 如何看一个网站做的如何58黄页网推广公司
  • 北京万网网站备案快速优化seo软件推广方法
  • 做网站的为什么一直拖平台推广计划
  • 泉州企业自助建站整站优化关键词推广
  • 旅游网站推荐排行榜百度灰色关键词排名代做
  • 重庆江北网站建设千锋教育培训机构就业率
  • 中国建设银行章丘支行网站广州建网站的公司
  • PHP网站开发程序员招聘百度推广关键词匹配模式
  • 营口化工网站建设湖南百度seo
  • 泊头网站建设甘肃公司培训课程有哪些
  • 深圳罗湖做网站的公司网络营销建议
  • 做包装的网站有哪些百度竞价收费标准
  • 天津网站设计哪里有正规的电商培训班
  • 送给做网站的锦旗语安卓优化大师官网
  • 济南j建设网白帽seo公司
  • 营销型网站制作公司上海谷歌seo公司
  • 微网站的图标怎么做站长工具高清无吗
  • 贵州最好的网站建设推广公司哪家好上海seo搜索优化
  • 2021年有没有人给个网站seo优化是做什么的
  • 群晖 wordpress加载慢赣州seo推广
  • wordpress 美化登录汕头seo外包机构
  • 信阳市人民政府官网领导分工网站优化包括对什么优化
  • 网站建设公司-跨界鱼科技优google搜索排名优化
  • 建网站用什么浏览器seo教程网站优化推广排名
  • 网站 多国语言seo在线优化工具
  • 揭阳市网站建设病毒式营销的案例