5H小说5HHHHH

首页 >5hhhhh / 正文

一个小小的程序

小说: 2025-09-01 11:01 5hhhhh 1060 ℃

[uploadedimage:19899696]

#include <stdio.h>

#include <stdlib.h>

//函数声明

int grade,gender,course; //年级,性别,选课

int rank,rankm,rankf,changed,changednum; //排名,前面男生,前面女生,进退步,进退步名次

int score,liberalscore,sciencescore; //惩罚分数计算:分数,文科,理科

int chinese, math, english, physics, chemistry, biology, politics, history, geography; //学科

int check; //验证

int main()

{

printf("欢迎使用体罚高中分数计算系统\n");

//输入基本信息

printf("年级(1/2/3): ");

scanf("%d", &grade);

if (grade>1){

printf("选课情况 文科(1)/理科(2):");

scanf("%d", &course);

}

printf("性别 女(1)/男(2): ");

scanf("%d", &gender);

//输入各科成绩

printf("请输入语文成绩: ");

scanf("%d", &chinese);

printf("请输入数学成绩: ");

scanf("%d", &math);

printf("请输入英语成绩: ");

scanf("%d", &english);

if (grade==1){

course==0;

printf("请输入物理成绩: ");

scanf("%d", &physics);

printf("请输入化学成绩: ");

scanf("%d", &chemistry);

printf("请输入生物成绩: ");

scanf("%d", &biology);

printf("请输入政治成绩: ");

scanf("%d", &politics);

printf("请输入历史成绩: ");

scanf("%d", &history);

printf("请输入地理成绩: ");

scanf("%d", &geography);

}

if (course==1){

printf("请输入政治成绩: ");

scanf("%d", &politics);

printf("请输入历史成绩: ");

scanf("%d", &history);

printf("请输入地理成绩: ");

scanf("%d", &geography);

}

else if (course==2){

printf("请输入物理成绩: ");

scanf("%d", &physics);

printf("请输入化学成绩: ");

scanf("%d", &chemistry);

printf("请输入生物成绩: ");

scanf("%d", &biology);

}

//排名

//printf("请输入本次考试排名( ): ");

//scanf("%d", &rank);

printf("排在你前面的男生有( ): ");

scanf("%d", &rankm);

printf("排在你前面的女生有( ): ");

scanf("%d", &rankf);

printf("您本次考试的排名变化为:进步(1)/退步(2),排名变化数为( ) \n");

scanf("%d%d", &changed,&changednum);

//验证学科成绩有效性

do

{

check==0;

if (chinese>150) {printf("您的语文成绩可能无效,请重新输入:\n");

printf("请输入语文成绩: ");

scanf("%d", &chinese);

check==1;

}

if (math>150) {printf("您的数学成绩可能无效,请重新输入:\n");

printf("请输入数学成绩: ");

scanf("%d", &math);

check==1;

}

if (english>150) {printf("您的英语成绩可能无效,请重新输入:\n");

printf("请输入英语成绩: ");

scanf("%d", &english);

check==1;

}

if (physics>100) {printf("您的物理成绩可能无效,请重新输入:\n");

printf("请输入物理成绩: ");

scanf("%d", &physics);

check==1;

}

if (chemistry>100) {printf("您的化学成绩可能无效,请重新输入:\n");

printf("请输入化学成绩: ");

scanf("%d", &chemistry);

check==1;

}

if (biology>100) {printf("您的生物成绩可能无效,请重新输入:\n");

printf("请输入生物成绩: ");

scanf("%d", &biology);

check==1;

}

if (politics>100) {printf("您的政治成绩可能无效,请重新输入:\n");

printf("请输入政治成绩: ");

scanf("%d", &politics);

check==1;

}

if (history>100) {printf("您的历史成绩可能无效,请重新输入:\n");

printf("请输入历史成绩: ");

scanf("%d", &history);

check==1;

}

if (geography>100) {printf("您的地理成绩可能无效,请重新输入:\n");

printf("请输入地理成绩: ");

scanf("%d", &geography);

check==1;

}

}while(check==1);

//计算学科体罚分数

if (chinese>=135) {score=score+(150-chinese);} //语文

else if (chinese>=125) {score=score+(150-chinese)*2;}

else if (chinese>=110) {score=score+(150-chinese)*3;}

else if (chinese>=90) {score=score+(150-chinese)*4;}

else if (chinese<90) {score=score+(150-chinese)*5;}

if (math>=140) {score=score+(150-math);} //数学

else if (math>=130) {score=score+(150-math)*2;}

else if (math>=120) {score=score+(150-math)*3;}

else if (math>=110) {score=score+(150-math)*4;}

else if (math<100) {score=score+(150-math)*5;}

if (english>=145) {score=score+(150-english);} //英语

else if (english>=135) {score=score+(150-english)*2;}

else if (english>=120) {score=score+(150-english)*3;}

else if (english>=105) {score=score+(150-english)*4;}

else if (english<105) {score=score+(150-english)*5;}

if (physics>=90) {sciencescore=sciencescore+(100-physics);} //物理

else if (physics>=80) {sciencescore=sciencescore+(100-physics)*2;}

else if (physics>=70) {sciencescore=sciencescore+(100-physics)*3;}

else if (physics>=60) {sciencescore=sciencescore+(100-physics)*4;}

else if (physics<60) {sciencescore=sciencescore+(100-physics)*5;}

if (chemistry>=90) {sciencescore=sciencescore+(100-chemistry);} //化学

else if (chemistry>=80) {sciencescore=sciencescore+(100-chemistry)*2;}

else if (chemistry>=70) {sciencescore=sciencescore+(100-chemistry)*3;}

else if (chemistry>=60) {sciencescore=sciencescore+(100-chemistry)*4;}

else if (chemistry<60) {sciencescore=sciencescore+(100-chemistry)*5;}

if (biology>=90) {sciencescore=sciencescore+(100-biology);} //生物

else if (biology>=80) {sciencescore=sciencescore+(100-biology)*2;}

else if (biology>=70) {sciencescore=sciencescore+(100-biology)*3;}

else if (biology>=60) {sciencescore=sciencescore+(100-biology)*4;}

else if (biology<60) {sciencescore=sciencescore+(100-biology)*5;}

if (politics>=90) {liberalscore=liberalscore+(100-politics);} //政治

else if (politics>=80) {liberalscore=liberalscore+(100-politics)*2;}

else if (politics>=70) {liberalscore=liberalscore+(100-politics)*3;}

else if (politics>=60) {liberalscore=liberalscore+(100-politics)*4;}

else if (politics<60) {liberalscore=liberalscore+(100-politics)*5;}

if (history>=90) {liberalscore=liberalscore+(100-history);} //历史

else if (history>=80) {liberalscore=liberalscore+(100-history)*2;}

else if (history>=70) {liberalscore=liberalscore+(100-history)*3;}

else if (history>=60) {liberalscore=liberalscore+(100-history)*4;}

else if (history<60) {liberalscore=liberalscore+(100-history)*5;}

if (geography>=90) {liberalscore=liberalscore+(100-geography);} //地理

else if (geography>=80) {liberalscore=liberalscore+(100-geography)*2;}

else if (geography>=70) {liberalscore=liberalscore+(100-geography)*3;}

else if (geography>=60) {liberalscore=liberalscore+(100-geography)*4;}

else if (geography<60) {liberalscore=liberalscore+(100-geography)*5;}

if (grade==1){score=score+(sciencescore+liberalscore)*0.7;} //高一给分

if (course==1){score=score+liberalscore*1.3;} //文科给分

else if (course==2){score=score+sciencescore*1.3;} //理科给分

if (gender==2){score=score*0.2;} //男生成绩分

if (gender==1){score=score+rankm+rankf*0.4;} //女生排名加权

else if (gender==2){score=score+rankm*0.2;} //男生排名加权

if (changed==1){ //进步

if (changednum>=300){score=score*0.6;printf("进步很大,恭喜\n");}

else if (changednum>=200){score=score*0.8;printf("有所进步,请继续保持\n");}

else if (changednum>=100){score=score*0.9;printf("有所进步,不错\n");}

else {printf("有所进步,再接再厉\n");}

}else if (changed==2){ //退步

if (changednum>=300){score=score*1.3;printf("退步很大,严厉批评\n");}

else if (changednum>=200){score=score*1.2;printf("有所退步,好好反思\n");}

else if (changednum>=100){score=score*1.1;printf("有所退步,继续调整\n");}

else {printf("有所退步,再加把劲\n");}

}

//成绩确认

printf("您参与体罚计算的科目成绩为\n");

printf("语文%d\n数学%d\n英语%d\n物理%d\n化学%d\n生物%d\n政治%d\n历史%d\n地理%d\n",chinese,math,english,physics,chemistry,biology,politics,history,geography);

printf("您的体罚分数为 :%d",score);

printf("\n");

if (score>=1800) {printf("您的体罚等级为 S\n");} //体罚等级显示

else if (score>=1400) {printf("您的体罚等级为 F\n");}

else if (score>=1000) {printf("您的体罚等级为 E\n");}

else if (score>=700) {printf("您的体罚等级为 D\n");}

else if (score>=400) {printf("您的体罚等级为 C\n");}

else if (score>=200) {printf("您的体罚等级为 B\n");}

else if (score>=100) {printf("您的体罚等级为 A\n");}

else if (score<100) {printf("您的体罚等级为 A+\n");}

system("pause");

return 0;

}

小说相关章节:

搜索
网站分类
标签列表