先介绍下背景吧,我们学校每年都有一次体育测试,这个很重要,四年如果没有一次及格(达到60分,总分100)的话,那就拿不到毕业证,如果及格了成绩达不到75,一切一切奖学金都拿不到,连参评的资格都没有,不管你的成绩是多么优秀,体测不到75,就一点希望也没有,唉,去年我的成绩可以说是不错,但是体测71分,所以。。。学生根据一张表可以自己计算自己的体测成绩,但是表的数据很多,查找起来有点麻烦,而且还得经过换算,所以我就想自己编个程序让计算机来帮我们计算分数,而我们只要简单的输入相关数据就可以了。
我就拿我的各项数据来做测试吧 。
代码如下:
#include <iostream> using namespace std; bool flag;//判断性别 double height,weight,lv,run,hand,jump;//定义身高,体重,肺活量,跑步,握力,跳远 double sum,sumjump,sumrun,index_haw,index_lvw,standard_heiw; //定义总成绩,立定跳远成绩,跑步成绩,握力体重指数成绩,肺活量体重指数成绩,身高标准体重成绩 void input() { int s; cout<<"男生请输入1 女生请输入2: "; cin>>s; if(s==1) flag=true; else flag=false; cout<<endl; cout<<"请输入以下数据:"<<endl; cout<<"身高(cm): "; cin>>height; cout<<"体重(kg): "; cin>>weight; cout<<"肺活量(ml): "; cin>>lv; if(flag) { cout<<"1000米成绩(s): "; cin>>run; } else { cout<<"800米成绩(s): "; cin>>run; } cout<<"握力(kg): "; cin>>hand; cout<<"跳远(cm): "; cin>>jump; } double m_ldty()//计算男生立定跳远成绩 { sumjump=0; if(jump>=266) sumjump=100; else if(jump>=265) sumjump=98; else if(jump>=263) sumjump=96; else if(jump>=262) sumjump=94; else if(jump>=260) sumjump=92; else if(jump>=258) sumjump=90; else if(jump>=256) sumjump=87;// else if(jump>=252) sumjump=84; else if(jump>=248) sumjump=81; else if(jump>=243) sumjump=78; else if(jump>=2.38) sumjump=75; else if(jump>=235) sumjump=72; else if(jump>=231) sumjump=69; else if(jump>=226) sumjump=66; else if(jump>=220) sumjump=63; else if(jump>=214) sumjump=60; else if(jump>=212) sumjump=50; else if(jump>=209) sumjump=40; else if(jump>=206) sumjump=30; else if(jump>=203) sumjump=20; else sumjump=10; sumjump*=0.2; return sumjump; } double f_ldty()//计算女生立定跳远成绩 { sumjump=0; if(jump>=207) sumjump=100; else if(jump>=206) sumjump=98; else if(jump>=205) sumjump=96; else if(jump>=203) sumjump=94; else if(jump>=201) sumjump=92; else if(jump>=199) sumjump=90; else if(jump>=197) sumjump=87;// else if(jump>=193) sumjump=84; else if(jump>=189) sumjump=81; else if(jump>=184) sumjump=78; else if(jump>=179) sumjump=75; else if(jump>=176) sumjump=72; else if(jump>=172) sumjump=69; else if(jump>=169) sumjump=66; else if(jump>=163) sumjump=63; else if(jump>=158) sumjump=60; else if(jump>=156) sumjump=50; else if(jump>=153) sumjump=40; else if(jump>=150) sumjump=30; else if(jump>=146) sumjump=20; else sumjump=10; sumjump*=0.2; return sumjump; } double male1000()//计算男生1000跑步成绩 { sumrun=0; if(run<=204) sumrun=100; else if(run<=207) sumrun=98; else if(run<=209) sumrun=96; else if(run<=212) sumrun=94; else if(run<=215) sumrun=92; else if(run<=218) sumrun=90; else if(run<=222) sumrun=87; else if(run<=226) sumrun=84; else if(run<=230) sumrun=81; else if(run<=234) sumrun=78; else if(run<=238) sumrun=75; else if(run<=243) sumrun=72; else if(run<=248) sumrun=69; else if(run<=253) sumrun=66; else if(run<=258) sumrun=63; else if(run<=263) sumrun=60; else if(run<=270) sumrun=50; else if(run<=277) sumrun=40; else if(run<=284) sumrun=30; else if(run<=291) sumrun=20; else sumrun=10; sumrun*=0.3; return sumrun; } double female800()//计算女生800跑步成绩 { sumrun=0; if(run<=207) sumrun=100; else if(run<=208) sumrun=98; else if(run<=211) sumrun=96; else if(run<=213) sumrun=94; else if(run<=215) sumrun=92; else if(run<=219) sumrun=90; else if(run<=222) sumrun=87; else if(run<=225) sumrun=84; else if(run<=229) sumrun=81; else if(run<=233) sumrun=78; else if(run<=238) sumrun=75; else if(run<=245) sumrun=72; else if(run<=252) sumrun=69; else if(run<=259) sumrun=66; else if(run<=266) sumrun=63; else if(run<=273) sumrun=60; else if(run<=280) sumrun=50; else if(run<=287) sumrun=40; else if(run<=294) sumrun=30; else if(run<=301) sumrun=20; else sumrun=10; sumrun*=0.3; return sumrun; } double m_woli_weight() { double temp=1.0*hand/weight*100; if(temp>=92) index_haw=100; else if(temp>=91) index_haw=98; else if(temp>=90) index_haw=96; else if(temp>=89) index_haw=94; else if(temp>=87) index_haw=92; else if(temp>=86) index_haw=90; else if(temp>=84) index_haw=87; else if(temp>=81) index_haw=84; else if(temp>=79) index_haw=81; else if(temp>=75) index_haw=78; else if(temp>=72) index_haw=75; else if(temp>=70) index_haw=72; else if(temp>=66) index_haw=69; else if(temp>=63) index_haw=66; else if(temp>=59) index_haw=63; else if(temp>=54) index_haw=60; else if(temp>=53) index_haw=50; else if(temp>=51) index_haw=40; else if(temp>=49) index_haw=30; else if(temp>=47) index_haw=20; else index_haw=10; index_haw*=0.2; return index_haw; } double f_woli_weight() { double temp=1.0*hand/weight*100; if(temp>=74) index_haw=100; else if(temp>=73) index_haw=98; else if(temp>=72) index_haw=96; else if(temp>=71) index_haw=94; else if(temp>=69) index_haw=92; else if(temp>=67) index_haw=90; else if(temp>=66) index_haw=87; else if(temp>=63) index_haw=84; else if(temp>=61) index_haw=81; else if(temp>=58) index_haw=78; else if(temp>=55) index_haw=75; else if(temp>=53) index_haw=72; else if(temp>=50) index_haw=69; else if(temp>=48) index_haw=66; else if(temp>=44) index_haw=63; else if(temp>=40) index_haw=60; else if(temp>=39) index_haw=50; else if(temp>=38) index_haw=40; else if(temp>=36) index_haw=30; else if(temp>=34) index_haw=20; else index_haw=10; index_haw*=0.2; return index_haw; } double m_fei_weight() { double temp=1.0*lv/weight; if(temp>=84) index_lvw=100; else if(temp>=83) index_lvw=98; else if(temp>=82) index_lvw=96; else if(temp>=81) index_lvw=94; else if(temp>=80) index_lvw=92; else if(temp>=78) index_lvw=90; else if(temp>=77) index_lvw=87; else if(temp>=75) index_lvw=84; else if(temp>=73) index_lvw=81; else if(temp>=71) index_lvw=78; else if(temp>=68) index_lvw=75; else if(temp>=66) index_lvw=72; else if(temp>=64) index_lvw=69; else if(temp>=61) index_lvw=66; else if(temp>=58) index_lvw=63; else if(temp>=55) index_lvw=60; else if(temp>=54) index_lvw=50; else if(temp>=52) index_lvw=40; else if(temp>=51) index_lvw=30; else if(temp>=49) index_lvw=20; else index_lvw=10; index_lvw*=0.2; return index_lvw; } double f_fei_weight() { double temp=1.0*lv/weight; if(temp>=70) index_lvw=100; else if(temp>=69) index_lvw=98; else if(temp>=68) index_lvw=96; else if(temp>=67) index_lvw=94; else if(temp>=65) index_lvw=92; else if(temp>=64) index_lvw=90; else if(temp>=63) index_lvw=87; else if(temp>=61) index_lvw=84; else if(temp>=59) index_lvw=81; else if(temp>=57) index_lvw=78; else if(temp>=54) index_lvw=75; else if(temp>=53) index_lvw=72; else if(temp>=51) index_lvw=69; else if(temp>=49) index_lvw=66; else if(temp>=46) index_lvw=63; else if(temp>=43) index_lvw=60; else if(temp>=42) index_lvw=50; else if(temp>=41) index_lvw=40; else if(temp>=39) index_lvw=30; else if(temp>=37) index_lvw=20; else index_lvw=10; index_lvw*=0.2; return index_lvw; } double male_standard() { if(height>=144.0&&height<=144.9) { if(weight<41.5) standard_heiw=50; else if(weight<=46.3) standard_heiw=60; else if(weight<=51.9) standard_heiw=100; else if(weight<=53.7) standard_heiw=60; else standard_heiw=50; } else if(height>=145.0&&height<=145.9) { if(weight<41.8) standard_heiw=50; else if(weight<=46.7) standard_heiw=60; else if(weight<=52.6) standard_heiw=100; else if(weight<=54.5) standard_heiw=60; else standard_heiw=50; } else if(height>=146.0&&height<=146.9) { if(weight<42.1) standard_heiw=50; else if(weight<=47.1) standard_heiw=60; else if(weight<=53.1) standard_heiw=100; else if(weight<=55.1) standard_heiw=60; else standard_heiw=50; } else if(height>=147.0&&height<=147.9) { if(weight<42.4) standard_heiw=50; else if(weight<=47.5) standard_heiw=60; else if(weight<=53.7) standard_heiw=100; else if(weight<=55.7) standard_heiw=60; else standard_heiw=50; } else if(height>=148.0&&height<=148.9) { if(weight<42.6) standard_heiw=50; else if(weight<=47.9) standard_heiw=60; else if(weight<=54.2) standard_heiw=100; else if(weight<=56.3) standard_heiw=60; else standard_heiw=50; } else if(height>=149.0&&height<=149.9) { if(weight<42.9) standard_heiw=50; else if(weight<=48.3) standard_heiw=60; else if(weight<=54.8) standard_heiw=100; else if(weight<=56.6) standard_heiw=60; else standard_heiw=50; } else if(height>=150.0&&height<=150.9) { if(weight<43.2) standard_heiw=50; else if(weight<=48.8) standard_heiw=60; else if(weight<=55.4) standard_heiw=100; else if(weight<=57.6) standard_heiw=60; else standard_heiw=50; } else if(height>=151.0&&height<=151.9) { if(weight<43.5) standard_heiw=50; else if(weight<=49.2) standard_heiw=60; else if(weight<=56.0) standard_heiw=100; else if(weight<=58.2) standard_heiw=60; else standard_heiw=50; } else if(height>=152.0&&height<=152.9) { if(weight<43.9) standard_heiw=50; else if(weight<=49.7) standard_heiw=60; else if(weight<=56.5) standard_heiw=100; else if(weight<=58.7) standard_heiw=60; else standard_heiw=50; } else if(height>=153.0&&height<=153.9) { if(weight<44.2) standard_heiw=50; else if(weight<=50.1) standard_heiw=60; else if(weight<=57.0) standard_heiw=100; else if(weight<=59.3) standard_heiw=60; else standard_heiw=50; } else if(height>=154.0&&height<=154.9) { if(weight<44.7) standard_heiw=50; else if(weight<=50.6) standard_heiw=60; else if(weight<=57.5) standard_heiw=100; else if(weight<=59.8) standard_heiw=60; else standard_heiw=50; } else if(height>=155.0&&height<=155.9) { if(weight<45.2) standard_heiw=50; else if(weight<=51.1) standard_heiw=60; else if(weight<=58.0) standard_heiw=100; else if(weight<=60.7) standard_heiw=60; else standard_heiw=50; } else if(height>=156.0&&height<=156.9) { if(weight<45.6) standard_heiw=50; else if(weight<=51.6) standard_heiw=60; else if(weight<=58.7) standard_heiw=100; else if(weight<=61.0) standard_heiw=60; else standard_heiw=50; } else if(height>=157.0&&height<=157.9) { if(weight<46.1) standard_heiw=50; else if(weight<=52.1) standard_heiw=60; else if(weight<=59.2) standard_heiw=100; else if(weight<=61.5) standard_heiw=60; else standard_heiw=50; } else if(height>=158.0&&height<=158.9) { if(weight<46.6) standard_heiw=50; else if(weight<=52.6) standard_heiw=60; else if(weight<=59.8) standard_heiw=100; else if(weight<=62.2) standard_heiw=60; else standard_heiw=50; } else if(height>=159.0&&height<=159.9) { if(weight<46.9) standard_heiw=50; else if(weight<=53.1) standard_heiw=60; else if(weight<=60.3) standard_heiw=100; else if(weight<=62.7) standard_heiw=60; else standard_heiw=50; } else if(height>=160.0&&height<=160.9) { if(weight<47.4) standard_heiw=50; else if(weight<=53.6) standard_heiw=60; else if(weight<=60.9) standard_heiw=100; else if(weight<=63.4) standard_heiw=60; else standard_heiw=50; } else if(height>=161.0&&height<=161.9) { if(weight<48.1) standard_heiw=50; else if(weight<=54.3) standard_heiw=60; else if(weight<=61.6) standard_heiw=100; else if(weight<=64.1) standard_heiw=60; else standard_heiw=50; } else if(height>=162.0&&height<=162.9) { if(weight<48.5) standard_heiw=50; else if(weight<=54.8) standard_heiw=60; else if(weight<=62.2) standard_heiw=100; else if(weight<=64.8) standard_heiw=60; else standard_heiw=50; } else if(height>=163.0&&height<=163.9) { if(weight<49.0) standard_heiw=50; else if(weight<=55.3) standard_heiw=60; else if(weight<=62.8) standard_heiw=100; else if(weight<=65.3) standard_heiw=60; else standard_heiw=50; } else if(height>=164.0&&height<=164.9) { if(weight<49.5) standard_heiw=50; else if(weight<=55.9) standard_heiw=60; else if(weight<=63.4) standard_heiw=100; else if(weight<=65.9) standard_heiw=60; else standard_heiw=50; } else if(height>=165.0&&height<=165.9) { if(weight<49.9) standard_heiw=50; else if(weight<=56.4) standard_heiw=60; else if(weight<=64.1) standard_heiw=100; else if(weight<=66.6) standard_heiw=60; else standard_heiw=50; } else if(height>=166.0&&height<=166.9) { if(weight<50.4) standard_heiw=50; else if(weight<=56.9) standard_heiw=60; else if(weight<=64.6) standard_heiw=100; else if(weight<=67) standard_heiw=60; else standard_heiw=50; } else if(height>=167.0&&height<=167.9) { if(weight<50.8) standard_heiw=50; else if(weight<=57.3) standard_heiw=60; else if(weight<=65) standard_heiw=100; else if(weight<=67.5) standard_heiw=60; else standard_heiw=50; } else if(height>=168.0&&height<=168.9) { if(weight<51.1) standard_heiw=50; else if(weight<=57.7) standard_heiw=60; else if(weight<=65.5) standard_heiw=100; else if(weight<=68.1) standard_heiw=60; else standard_heiw=50; } else if(height>=169.0&&height<=169.9) { if(weight<51.6) standard_heiw=50; else if(weight<=58.2) standard_heiw=60; else if(weight<=66) standard_heiw=100; else if(weight<=68.6) standard_heiw=60; else standard_heiw=50; } else if(height>=170.0&&height<=170.9) { if(weight<52.1) standard_heiw=50; else if(weight<=58.7) standard_heiw=60; else if(weight<=66.5) standard_heiw=100; else if(weight<=69.1) standard_heiw=60; else standard_heiw=50; } else if(height>=171.0&&height<=171.9) { if(weight<52.5) standard_heiw=50; else if(weight<=59.2) standard_heiw=60; else if(weight<=67.2) standard_heiw=100; else if(weight<=69.8) standard_heiw=60; else standard_heiw=50; } else if(height>=172.0&&height<=172.9) { if(weight<53) standard_heiw=50; else if(weight<=59.8) standard_heiw=60; else if(weight<=67.8) standard_heiw=100; else if(weight<=70.4) standard_heiw=60; else standard_heiw=50; } else if(height>=173.0&&height<=173.9) { if(weight<53.5) standard_heiw=50; else if(weight<=60.3) standard_heiw=60; else if(weight<=68.4) standard_heiw=100; else if(weight<=71.1) standard_heiw=60; else standard_heiw=50; } else if(height>=174.0&&height<=174.9) { if(weight<53.8) standard_heiw=50; else if(weight<=61) standard_heiw=60; else if(weight<=69.3) standard_heiw=100; else if(weight<=72) standard_heiw=60; else standard_heiw=50; } else if(height>=175.0&&height<=175.9) { if(weight<54.5) standard_heiw=50; else if(weight<=61.5) standard_heiw=60; else if(weight<=69.9) standard_heiw=100; else if(weight<=72.7) standard_heiw=60; else standard_heiw=50; } else if(height>=176.0&&height<=176.9) { if(weight<55.3) standard_heiw=50; else if(weight<=62.2) standard_heiw=60; else if(weight<=70.9) standard_heiw=100; else if(weight<=73.8) standard_heiw=60; else standard_heiw=50; } else if(height>=177.0&&height<=177.9) { if(weight<55.8) standard_heiw=50; else if(weight<=62.7) standard_heiw=60; else if(weight<=71.6) standard_heiw=100; else if(weight<=74.5) standard_heiw=60; else standard_heiw=50; } else if(height>=178.0&&height<=178.9) { if(weight<56.2) standard_heiw=50; else if(weight<=63.3) standard_heiw=60; else if(weight<=72.3) standard_heiw=100; else if(weight<=75.3) standard_heiw=60; else standard_heiw=50; } else if(height>=179.0&&height<=179.9) { if(weight<56.7) standard_heiw=50; else if(weight<=63.8) standard_heiw=60; else if(weight<=72.8) standard_heiw=100; else if(weight<=75.8) standard_heiw=60; else standard_heiw=50; } else if(height>=180.0&&height<=180.9) { if(weight<57.1) standard_heiw=50; else if(weight<=64.3) standard_heiw=60; else if(weight<=73.5) standard_heiw=100; else if(weight<=76.5) standard_heiw=60; else standard_heiw=50; } else if(height>=181.0&&height<=181.9) { if(weight<57.7) standard_heiw=50; else if(weight<=64.9) standard_heiw=60; else if(weight<=74.2) standard_heiw=100; else if(weight<=77.3) standard_heiw=60; else standard_heiw=50; } else if(height>=182.0&&height<=182.9) { if(weight<58.2) standard_heiw=50; else if(weight<=65.6) standard_heiw=60; else if(weight<=74.9) standard_heiw=100; else if(weight<=77.8) standard_heiw=60; else standard_heiw=50; } else if(height>=183.0&&height<=183.9) { if(weight<58.8) standard_heiw=50; else if(weight<=66.2) standard_heiw=60; else if(weight<=75.7) standard_heiw=100; else if(weight<=78.8) standard_heiw=60; else standard_heiw=50; } else if(height>=184.0&&height<=184.9) { if(weight<59.3) standard_heiw=50; else if(weight<=66.8) standard_heiw=60; else if(weight<=76.3) standard_heiw=100; else if(weight<=79.4) standard_heiw=60; else standard_heiw=50; } else if(height>=185.0&&height<=185.9) { if(weight<59.9) standard_heiw=50; else if(weight<=67.4) standard_heiw=60; else if(weight<=77) standard_heiw=100; else if(weight<=80.2) standard_heiw=60; else standard_heiw=50; } else if(height>=186.0&&height<=186.9) { if(weight<60.4) standard_heiw=50; else if(weight<=68.1) standard_heiw=60; else if(weight<=77.8) standard_heiw=100; else if(weight<=81.1) standard_heiw=60; else standard_heiw=50; } else if(height>=187.0&&height<=187.9) { if(weight<60.9) standard_heiw=50; else if(weight<=68.7) standard_heiw=60; else if(weight<=78.6) standard_heiw=100; else if(weight<=81.9) standard_heiw=60; else standard_heiw=50; } else if(height>=188.0&&height<=188.9) { if(weight<61.4) standard_heiw=50; else if(weight<=69.2) standard_heiw=60; else if(weight<=79.3) standard_heiw=100; else if(weight<=82.6) standard_heiw=60; else standard_heiw=50; } else if(height>=189.0&&height<=189.9) { if(weight<61.8) standard_heiw=50; else if(weight<=69.8) standard_heiw=60; else if(weight<=79.9) standard_heiw=100; else if(weight<=83.2) standard_heiw=60; else standard_heiw=50; } else if(height>=190.0&&height<=190.9) { if(weight<62.4) standard_heiw=50; else if(weight<=70.4) standard_heiw=60; else if(weight<=80.5) standard_heiw=100; else if(weight<=83.6) standard_heiw=60; else standard_heiw=50; } standard_heiw*=0.1; return standard_heiw; } double female_standard() { if(height>=140.0&&height<=140.9) { if(weight<36.5) standard_heiw=50; else if(weight<=42.4) standard_heiw=60; else if(weight<=50.6) standard_heiw=100; else if(weight<=53.3) standard_heiw=60; else standard_heiw=50; } else if(height>=141.0&&height<=141.9) { if(weight<36.6) standard_heiw=50; else if(weight<=42.9) standard_heiw=60; else if(weight<=51.3) standard_heiw=100; else if(weight<=54.1) standard_heiw=60; else standard_heiw=50; } else if(height>=142.0&&height<=142.9) { if(weight<36.8) standard_heiw=50; else if(weight<=43.2) standard_heiw=60; else if(weight<=51.9) standard_heiw=100; else if(weight<=54.7) standard_heiw=60; else standard_heiw=50; } else if(height>=143.0&&height<=143.9) { if(weight<37) standard_heiw=50; else if(weight<=43.5) standard_heiw=60; else if(weight<=52.3) standard_heiw=100; else if(weight<=55.2) standard_heiw=60; else standard_heiw=50; } else if(height>=144.0&&height<=144.9) { if(weight<37.2) standard_heiw=50; else if(weight<=43.7) standard_heiw=60; else if(weight<=52.7) standard_heiw=100; else if(weight<=56.6) standard_heiw=60; else standard_heiw=50; } else if(height>=145.0&&height<=145.9) { if(weight<37.5) standard_heiw=50; else if(weight<=44) standard_heiw=60; else if(weight<=53.1) standard_heiw=100; else if(weight<=56.1) standard_heiw=60; else standard_heiw=50; } else if(height>=146.0&&height<=146.9) { if(weight<37.9) standard_heiw=50; else if(weight<=44.4) standard_heiw=60; else if(weight<=53.7) standard_heiw=100; else if(weight<=56.7) standard_heiw=60; else standard_heiw=50; } else if(height>=147.0&&height<=147.9) { if(weight<38.5) standard_heiw=50; else if(weight<=44) standard_heiw=60; else if(weight<=54.3) standard_heiw=100; else if(weight<=57.3) standard_heiw=60; else standard_heiw=50; } else if(height>=148.0&&height<=148.9) { if(weight<39.1) standard_heiw=50; else if(weight<=45.7) standard_heiw=60; else if(weight<=55.0) standard_heiw=100; else if(weight<=58.0) standard_heiw=60; else standard_heiw=50; } else if(height>=149.0&&height<=149.9) { if(weight<39.5) standard_heiw=50; else if(weight<=46.2) standard_heiw=60; else if(weight<=55.6) standard_heiw=100; else if(weight<=58.7) standard_heiw=60; else standard_heiw=50; } else if(height>=150.0&&height<=150.9) { if(weight<39.9) standard_heiw=50; else if(weight<=46.6) standard_heiw=60; else if(weight<=56.2) standard_heiw=100; else if(weight<=59.3) standard_heiw=60; else standard_heiw=50; } else if(height>=151.0&&height<=151.9) { if(weight<40.3) standard_heiw=50; else if(weight<=47.1) standard_heiw=60; else if(weight<=56.7) standard_heiw=100; else if(weight<=59.8) standard_heiw=60; else standard_heiw=50; } else if(height>=152.0&&height<=152.9) { if(weight<40.8) standard_heiw=50; else if(weight<=47.6) standard_heiw=60; else if(weight<=57.4) standard_heiw=100; else if(weight<=60.5) standard_heiw=60; else standard_heiw=50; } else if(height>=153.0&&height<=153.9) { if(weight<41.4) standard_heiw=50; else if(weight<=48.2) standard_heiw=60; else if(weight<=57.9) standard_heiw=100; else if(weight<=61.1) standard_heiw=60; else standard_heiw=50; } else if(height>=154.0&&height<=154.9) { if(weight<41.9) standard_heiw=50; else if(weight<=48.8) standard_heiw=60; else if(weight<=58.6) standard_heiw=100; else if(weight<=61.9) standard_heiw=60; else standard_heiw=50; } else if(height>=155.0&&height<=155.9) { if(weight<42.3) standard_heiw=50; else if(weight<=49.1) standard_heiw=60; else if(weight<=59.1) standard_heiw=100; else if(weight<=62.4) standard_heiw=60; else standard_heiw=50; } else if(height>=156.0&&height<=156.9) { if(weight<42.9) standard_heiw=50; else if(weight<=49.7) standard_heiw=60; else if(weight<=59.7) standard_heiw=100; else if(weight<=63) standard_heiw=60; else standard_heiw=50; } else if(height>=157.0&&height<=157.9) { if(weight<43.5) standard_heiw=50; else if(weight<=50.3) standard_heiw=60; else if(weight<=60.4) standard_heiw=100; else if(weight<=63.6) standard_heiw=60; else standard_heiw=50; } else if(height>=158.0&&height<=158.9) { if(weight<44) standard_heiw=50; else if(weight<=50.8) standard_heiw=60; else if(weight<=61.2) standard_heiw=100; else if(weight<=64.5) standard_heiw=60; else standard_heiw=50; } else if(height>=159.0&&height<=159.9) { if(weight<44.5) standard_heiw=50; else if(weight<=51.4) standard_heiw=60; else if(weight<=61.7) standard_heiw=100; else if(weight<=65.1) standard_heiw=60; else standard_heiw=50; } else if(height>=160.0&&height<=160.9) { if(weight<45.0) standard_heiw=50; else if(weight<=52.1) standard_heiw=60; else if(weight<=62.3) standard_heiw=100; else if(weight<=65.6) standard_heiw=60; else standard_heiw=50; } else if(height>=161.0&&height<=161.9) { if(weight<45.4) standard_heiw=50; else if(weight<=52.5) standard_heiw=60; else if(weight<=62.8) standard_heiw=100; else if(weight<=66.2) standard_heiw=60; else standard_heiw=50; } else if(height>=162.0&&height<=162.9) { if(weight<45.9) standard_heiw=50; else if(weight<=53.1) standard_heiw=60; else if(weight<=63.4) standard_heiw=100; else if(weight<=66.8) standard_heiw=60; else standard_heiw=50; } else if(height>=163.0&&height<=163.9) { if(weight<46.4) standard_heiw=50; else if(weight<=53.6) standard_heiw=60; else if(weight<=63.9) standard_heiw=100; else if(weight<=67.3) standard_heiw=60; else standard_heiw=50; } else if(height>=164.0&&height<=164.9) { if(weight<46.8) standard_heiw=50; else if(weight<=54.2) standard_heiw=60; else if(weight<=64.5) standard_heiw=100; else if(weight<=67.9) standard_heiw=60; else standard_heiw=50; } else if(height>=165.0&&height<=165.9) { if(weight<47.4) standard_heiw=50; else if(weight<=54.8) standard_heiw=60; else if(weight<=65) standard_heiw=100; else if(weight<=68.3) standard_heiw=60; else standard_heiw=50; } else if(height>=166.0&&height<=166.9) { if(weight<48) standard_heiw=50; else if(weight<=55.4) standard_heiw=60; else if(weight<=65.5) standard_heiw=100; else if(weight<=68.9) standard_heiw=60; else standard_heiw=50; } else if(height>=167.0&&height<=167.9) { if(weight<48.5) standard_heiw=50; else if(weight<=56) standard_heiw=60; else if(weight<=66.2) standard_heiw=100; else if(weight<=69.5) standard_heiw=60; else standard_heiw=50; } else if(height>=168.0&&height<=168.9) { if(weight<49) standard_heiw=50; else if(weight<=56.4) standard_heiw=60; else if(weight<=66.7) standard_heiw=100; else if(weight<=70.1) standard_heiw=60; else standard_heiw=50; } else if(height>=169.0&&height<=169.9) { if(weight<49.4) standard_heiw=50; else if(weight<=56.8) standard_heiw=60; else if(weight<=67.3) standard_heiw=100; else if(weight<=70.7) standard_heiw=60; else standard_heiw=50; } else if(height>=170.0&&height<=170.9) { if(weight<49.9) standard_heiw=50; else if(weight<=57.3) standard_heiw=60; else if(weight<=67.9) standard_heiw=100; else if(weight<=71.4) standard_heiw=60; else standard_heiw=50; } else if(height>=171.0&&height<=171.9) { if(weight<50.2) standard_heiw=50; else if(weight<=57.8) standard_heiw=60; else if(weight<=68.5) standard_heiw=100; else if(weight<=72.1) standard_heiw=60; else standard_heiw=50; } else if(height>=172.0&&height<=172.9) { if(weight<50.7) standard_heiw=50; else if(weight<=58.4) standard_heiw=60; else if(weight<=69.1) standard_heiw=100; else if(weight<=72.7) standard_heiw=60; else standard_heiw=50; } else if(height>=173.0&&height<=173.9) { if(weight<51) standard_heiw=50; else if(weight<=58.8) standard_heiw=60; else if(weight<=69.6) standard_heiw=100; else if(weight<=73.1) standard_heiw=60; else standard_heiw=50; } else if(height>=174.0&&height<=174.9) { if(weight<51.3) standard_heiw=50; else if(weight<=59.3) standard_heiw=60; else if(weight<=70.2) standard_heiw=100; else if(weight<=73.6) standard_heiw=60; else standard_heiw=50; } else if(height>=175.0&&height<=175.9) { if(weight<51.9) standard_heiw=50; else if(weight<=59.9) standard_heiw=60; else if(weight<=70.8) standard_heiw=100; else if(weight<=74.4) standard_heiw=60; else standard_heiw=50; } else if(height>=176.0&&height<=176.9) { if(weight<52.4) standard_heiw=50; else if(weight<=60.4) standard_heiw=60; else if(weight<=71.5) standard_heiw=100; else if(weight<=75.1) standard_heiw=60; else standard_heiw=50; } else if(height>=177.0&&height<=177.9) { if(weight<52.8) standard_heiw=50; else if(weight<=61) standard_heiw=60; else if(weight<=72.1) standard_heiw=100; else if(weight<=75.7) standard_heiw=60; else standard_heiw=50; } else if(height>=178.0&&height<=178.9) { if(weight<53.2) standard_heiw=50; else if(weight<=61.5) standard_heiw=60; else if(weight<=72.6) standard_heiw=100; else if(weight<=76.2) standard_heiw=60; else standard_heiw=50; } else if(height>=179.0&&height<=179.9) { if(weight<53.6) standard_heiw=50; else if(weight<=62) standard_heiw=60; else if(weight<=73.2) standard_heiw=100; else if(weight<=76.7) standard_heiw=60; else standard_heiw=50; } else if(height>=180.0&&height<=180.9) { if(weight<54.1) standard_heiw=50; else if(weight<=62.5) standard_heiw=60; else if(weight<=73.7) standard_heiw=100; else if(weight<=77) standard_heiw=60; else standard_heiw=50; } else if(height>=181.0&&height<=181.9) { if(weight<54.5) standard_heiw=50; else if(weight<=63.1) standard_heiw=60; else if(weight<=74.3) standard_heiw=100; else if(weight<=77.8) standard_heiw=60; else standard_heiw=50; } else if(height>=182.0&&height<=182.9) { if(weight<55.1) standard_heiw=50; else if(weight<=63.8) standard_heiw=60; else if(weight<=75) standard_heiw=100; else if(weight<=79.4) standard_heiw=60; else standard_heiw=50; } else if(height>=183.0&&height<=183.9) { if(weight<55.6) standard_heiw=50; else if(weight<=64.5) standard_heiw=60; else if(weight<=75.7) standard_heiw=100; else if(weight<=80.4) standard_heiw=60; else standard_heiw=50; } else if(height>=184.0&&height<=184.9) { if(weight<56.1) standard_heiw=50; else if(weight<=65.3) standard_heiw=60; else if(weight<=76.6) standard_heiw=100; else if(weight<=81.2) standard_heiw=60; else standard_heiw=50; } else if(height>=185.0&&height<=185.9) { if(weight<56.8) standard_heiw=50; else if(weight<=66.1) standard_heiw=60; else if(weight<=77.5) standard_heiw=100; else if(weight<=82.4) standard_heiw=60; else standard_heiw=50; } else if(height>=186.0&&height<=186.9) { if(weight<57.3) standard_heiw=50; else if(weight<=66.9) standard_heiw=60; else if(weight<=78.6) standard_heiw=100; else if(weight<=83.3) standard_heiw=60; else standard_heiw=50; } standard_heiw*=0.1; return standard_heiw; } int main() { input(); cout<<endl; cout<<"**************************"<<endl; cout<<endl; //double sum,sumjump,sumrun,index_haw,index_lvw,standard_heiw; //定义总成绩,立定跳远成绩,跑步成绩,握力体重指数成绩,肺活量体重指数成绩,身高标准体重成绩 if(flag) { sum=m_ldty()+male1000()+m_woli_weight()+m_fei_weight()+male_standard(); cout<<"立定跳远成绩为: "<<m_ldty()<<endl; cout<<"1000跑步成绩为: "<<male1000()<<endl; cout<<"握力体重指数成绩为: "<<m_woli_weight()<<endl; cout<<"肺活量体重指数成绩为: "<<m_fei_weight()<<endl; cout<<"身高标准体重成绩为: "<<male_standard()<<endl; cout<<endl; cout<<"总成绩为:"<<sum<<endl; cout<<endl; cout<<"**************************"; } else { sum=f_ldty()+female800()+f_woli_weight()+f_fei_weight()+female_standard(); cout<<"立定跳远成绩为: "<<f_ldty()<<endl; cout<<"800跑步成绩为: "<<female800()<<endl; cout<<"握力体重指数成绩为: "<<f_woli_weight()<<endl; cout<<"肺活量体重指数成绩为: "<<f_fei_weight()<<endl; cout<<"身高标准体重成绩为: "<<female_standard()<<endl; cout<<endl; cout<<"总成绩为:"<<sum<<endl; cout<<endl; cout<<"**************************"; } return 0; }
代码虽然很长,但没有复杂的语句,很多都是重复的,就是那些数据得一个一个得边看表边写代码,表上那些密密麻麻的数据快把我的眼看瞎了。不过最后终于完成了,还是挺高兴的。
运行截图: