c语言计算一学年加权平均分_第1页
c语言计算一学年加权平均分_第2页
c语言计算一学年加权平均分_第3页
c语言计算一学年加权平均分_第4页
c语言计算一学年加权平均分_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、功能:计算一整学年的加权平均分,输出各科成绩及加权平均分。流程图:开始输出 input the students No:输入No/ 输出 input the students Birthday(YYYY-MM-DD):输入 Year,Month,Day输出 input the students Scores(Math1):输入Math1输出 input the students Scores(Math2):输入Math2输出 input the students Scores(IdeologicalandMoralCultivationandBasicLawEducation):输入 Ideo

2、logicalandMoralCultivationandBasicLawEducationTotal=Math1+Math2+IdeologicalandMoralCultivationandBasicLawEducationAverage=Total/17WeightedAverage=(5*Math1+5*Math2+3*English1+3*English2+1*MilitaryTheory+3*Chemistry+4*Physics+2*theModernHistoryofChina+3.5*Computer+0.5*MathematicalExperiment1+0.5*Mathe

3、maticalExperiment2+5*Circuit+3*LinearAlgebra+2.5*PrincipleofMarxism+2*MentalHealth+2.5*EngineeringGraphics+2.5*IdeologicalandMoralCultivationandBasicLawEducation)/(5+5+3+3+1+3+4+2+3.5+0.5+0.5+5+3+2.5+2+2.5+2.5)输出 Math1,Math2,Total,Average,WeightedAverage结束N-S 图:输出 input the students No:输入No输出 input

4、the students Birthday(YYYY-MM-DD):输入 Year,Month,Day输出 input the students Scores(Math1):输入Math1输出 input the students Scores(IdeologicalandMoralCultivationandBasicLawEducation):输入 IdeologicalandMoralCultivationandBasicLawEducation1Total=Math1+Math2+IdeologicalandMoralCultivationandBasicLawEducationAve

5、rage=Total/17WeightedAverage=(5*Math1+5*Math2+3*English1+3*English2+1*MilitaryTheory+3*Chemistry+4*Physics+2*theModernHistoryofChina+3.5*Computer+0.5*MathematicalExperiment1+0.5*MathematicalExperiment2+5*Circuit+3*LinearAlgebra+2.5*PrincipleofMarxism+2*MentalHealth+2.5*EngineeringGraphics+2.5*Ideolo

6、gicalandMoralCultivationandBasicLawEducation)/(5+5+3+3+1+3+4+2+3.5+0.5+0.5+5+3+2.5+2+2.5+2.5)输出 Math1,Math2,Total,Average,WeightedAverage源代码:#include void main ()unsigned long No; 学号/unsigned int Year,Month,Day/ 生日float Math1,Math2,English1,English2,MilitaryTheory,Chemistry,Physics,theModernHistoryo

7、fChina,Computer;成绩/float MathematicalExperiment1,MathematicalExperiment2,Circuit,LinearAlgebra,PrincipleofMarxism; / 成 绩/float MentalHealth,EngineeringGraphics,IdeologicalandMoralCultivationandBasicLawEducation; 成绩/float Total,Average,WeightedAverage; /总分、平均分、加权平均分/printf(input the students No:);sca

8、nf(%8ld,&No);printf(input the students Birthday(YYYY-MM-DD):);scanf(%4d-%2d-%2d,&Year,&Month,&Day);printf(input the students Scores(Math1):);scanf(%f,&Math1);printf(input the students Scores(Math2):);scanf(%f,&Math2);printf(input the students Scores(English1):);scanf(%f,&English1);printf(input the s

9、tudents Scores(English2):);scanf(%f,&English2);printf(input the students Scores(MilitaryTheory):);scanf(%f,&MilitaryTheory);printf(input the students Scores(Chemistry):);scanf(%f,&Chemistry);printf(input the students Scores(Physics):);scanf(%f,&Physics);printf(input the students Scores(theModernHist

10、oryofChina):);scanf(%f,&theModernHistoryofChina);printf(input the students Scores(Computer):);scanf(%f,&Computer);printf(input the students Scores(MathematicalExperiment1):);scanf(%f,&MathematicalExperiment1);printf(input the students Scores(MathematicalExperiment2):);scanf(%f,&MathematicalExperimen

11、t2);printf(input the students Scores(Circuit):);scanf(%f,&Circuit);printf(input the students Scores(LinearAlgebra):);scanf(%f,&LinearAlgebra);printf(input the students Scores(PrincipleofMarxism):);scanf(%f,&PrincipleofMarxism);printf(input the students Scores(MentalHealth):);scanf(%f,&MentalHealth);

12、printf(input the students Scores(EngineeringGraphics):);scanf(%f,&EngineeringGraphics);printf(input the students Scores(IdeologicalandMoralCultivationandBasicLawEducation):); scanf(%f,&IdeologicalandMoralCultivationandBasicLawEducation);Total=Math1+Math2+English1+English2+MilitaryTheory+Chemistry+Ph

13、ysics+theModernHistoryofChina+Com puter+MathematicalExperiment1+MathematicalExperiment2+Circuit+LinearAlgebra+PrincipleofMarxism+Mental Health+EngineeringGraphics+IdeologicalandMoralCultivationandBasicLawEducation;Average=Total/17;WeightedAverage=(5*Math1+5*Math2+3*English1+3*English2+1*MilitaryTheo

14、ry+3*Chemistry+4*Physics+2 *theModernHistoryofChina+3.5*Computer+0.5*MathematicalExperiment1+0.5*MathematicalExperiment2+5*Cir cuit+3*LinearAlgebra+2.5*PrincipleofMarxism+2*MentalHealth+2.5*EngineeringGraphics+2.5*IdeologicalandMor alCultivationandBasicLawEducation)/(5+5+3+3+1+3+4+2+3.5+0.5+0.5+5+3+

15、2.5+2+2.5+2.5);printf(nNo:%8ldnBirthday:1%4d-%2d-%2dnMath1:%7.2fnMath2:%7.2fnEnglish1:%7.2fnEnglish2:%7.2f nMilitaryTheory:%7.2fnChemistry:%7.2fnPhysics:%7.2fntheModernHistoryofChina:%7.2fnComputer:%7.2fn MathematicalExperiment1:%7.2fnMathematicalExperiment2:%7.2fnCircuit:%7.2fnLinearAlgebra:%7.2fnP

16、rinci pleofMarxism:%7.2fnMentalHealth:%7.2fnEngineeringGraphics:%7.2fnIdeologicalandMoralCultivationandBasic LawEducation:%7.2fnTotal:%7.2fnAverage:%7.2fnnWeightedAverage:%7.2fn,No,Year,Month,Day,Math1,Mat h2,English1,English2,MilitaryTheory,Chemistry,Physics,theModernHistoryofChina,Computer,Mathema

17、ticalExperim ent1,MathematicalExperiment2,Circuit,LinearAlgebra,PrincipleofMarxism,MentalHealth,EngineeringGraphics,Ideo logicalandMoralCultivationandBasicLawEducation,Total,Average,WeightedAverage);运行结果:+Microsoft Visual SludMyProjectspractiseDebugwei ghted avefae.exeinput input; input input: input

18、 input input input input in put: input input; liipiiit input input: input input Input input 1tlie tlic the tFie the tlie tlic the the the tlie tlic tlie the the t:llG tlic tllE thestiident1 窖 stiidentf 葬stuilEnts s stmilBnt1 s studentJ $student*sstmdDntJ s stiidentf 葬 student1s stuflents s studentJ

19、s studentJ $ studentJs student*s叵Nos &21tQlld5D ipfchday ( V V V-HH-ID: 1957-i i-20Scoiresl1 =9?ScDres:81cavesCEnyllslil D : 0ScoresEng*LiliS1 : 92Score3 :91SicoresChenilstr ) : 88Scoves:78S c: ares C t he Haderr H is. t a viof Ch in a :8&ScorasConpLiter ) s 83corcscpcr!incntl = 92Scores = 96Scores:98ScaivestLiinieavAlgehpa) :7SScoiBsPpi.nci.pleofs 95Scorcs =8GS cares :?9S

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论