当前位置:首页 » 编程语言 » 编一个程序计算学生奖学金c语言
扩展阅读
webinf下怎么引入js 2023-08-31 21:54:13
堡垒机怎么打开web 2023-08-31 21:54:11

编一个程序计算学生奖学金c语言

发布时间: 2023-08-31 07:14:51

❶ C语言编程题 奖学金

#include <iostream>
#include <math>
using namespace std;
void printAward(int value1, int value2, int value3)
{
if(value1 >= 90 && value2 >= 90 && value3 >= 90)
{
cout<<"等级1";
}
else if(value1 >=80&& value2 >= 80 && value3 >= 80)
{
cout<<"等级2";
}
else
{
int minVal = min(min(value1, value2), min(value2, value3));
int maxVal = max(max(value1, value2), max(value2, value3));
int midVal = value1 + value2 + value3 - minVal - maxVal;
if(midVal >= 90 && minVal >= 70)
{
cout<<"等级2";
}
else
{
cout<<"无奖学金";
}
}
}

void main()
{
int value1, value2, value3;
cin>>value1>>value2>>value3;
printAward(value1, value2, value3);
}

❷ C语言奖学金

#include<stdio.h>
#include<stdlib.h>


typedefstructStudent{

intsnum;
charscore[10];
intsum;
}Student;
intmain(){
intn;
scanf("%d",&n);
Studenta[128];
inti,j;
for(i=0;i<n;i++){
a[i].snum=i+1;
a[i].sum=0;
for(j=0;j<3;j++){
scanf("%d",&a[i].score[j]);
a[i].sum+=a[i].score[j];
}
}
Studenttmp;
for(j=n-1;j>0;j--){
for(i=0;i<j;i++){
if(a[i].sum<a[i+1].sum){
tmp=a[i];
a[i]=a[i+1];
a[i+1]=tmp;
}
elseif(a[i].sum==a[i+1].sum){
if(a[i].score[0]<a[i+1].score[0]){
tmp=a[i];
a[i]=a[i+1];
a[i+1]=tmp;
}
}
}
}
for(i=0;i<5;i++){
printf("%d%d ",a[i].snum,a[i].sum);
}
system("pause");
return0;
}

❸ 用C语言编一个程序,计算学生奖学金的等级,以三门功课成绩M1,M2,M3为评奖依据。奖学金评定标准如下:

char panding(float M1, float M2, float M3)
{
char res;
if(M1 + M2 + M3 >95*3)
{
res ='A';
}
else if(M1 ==100 & M2 ==100 &M3>=80)
{
res ='A';
}
else if(M1 ==100 & M3 ==100 &M2>=80)
{
res ='A';
}
else if(M2 ==100 & M3 ==100 &M1>=80)
{
res ='A'弊烂;
}
else if(M1+M2+M3>90*3)
{
res ='B';
}
else if(M1==100 & M2>75 & M3>75)
{
res ='B';
}
else if(M2==100 & M1>75 & M3>75)
{
res ='B'岁败;
}
else if(M3==100 & M1>75 & M2>75)
{
res ='B';
}
else if(M1>75 & M2>乎卜颤75 & M3>75)
{
res ='C';
}
else
{
res ='0';
}
return res;
}