统计成绩.cpp
来自「c++算法的很经典的一些小练习 看了 觉得还可以 给大家分享一下!」· C++ 代码 · 共 19 行
CPP
19 行
#include<iostream.h>
int &level(int gread,int &typeA,int &typeB,int &typeC);
void main(){
int typeA=0,typeB=0,typeC=0;
int stu=9;
int a[9]={90,75,83,66,58,40,80,85,71};
for(int i=0;i<stu;i++)
level(a[i],typeA,typeB,typeC)++;
cout<<"A类学生数"<<typeA<<endl;
cout<<"B类学生数"<<typeB<<endl;
cout<<"C类学生数"<<typeC<<endl;
}
int &level(int gread,int &typeA,int &typeB,int &typeC){
if(gread>=80)return typeA;
else if(gread>=60)return typeB;
else return typeC;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?