导航:首页 > 保研推免 > 奖学金问题c语言代码

奖学金问题c语言代码

发布时间:2020-12-27 22:16:19

奖学金评定问题c语言程序

#include<stdio.h>

#defineN8 //这里指学生人数,可以根据实际题目修改
#defineM3

voidExchange(intid[],intsum[],intscore[][M],inti,intj)
{
//互换学生i和j的成绩,学号
inttemp;
intk;
temp=id[i];id[i]=id[j];id[j]=temp;
temp=sum[i];sum[i]=sum[j];sum[j]=temp;
for(k=0;k<M;k++)
{
temp=score[i][k];
score[i][k]=score[j][k];
score[j][k]=temp;
}
}

intmain()
{
intscore[N][M]={0}; //用于存放学生成绩的数组
intid[N]={0}; //学号
intsum[N]={0}; //每位同学总分
//0号位:语文;1号位:数学; 2号位:英语
inti,j,k; //循环变量
for(i=0;i<N;i++)
{
scanf("%d",&id[i]); //输入学号
for(j=0;j<M;j++)
{
scanf("%d",&score[i][j]);
sum[i]+=score[i][j];
}
}
for(i=0;i<N-1;i++)
{
k=i;
for(j=i+1;j<N;j++)
{
if(sum[j]>sum[k])
{
k=j;
}
}
if(k!=i)
{
Exchange(id,sum,score,k,i);
}
}
//进行总分相同的学生的成绩重新排名
for(i=0;i<N-1;)
{
if(sum[i]!=sum[i+1])
{
i++;
}
else
{
if(score[i][0]<score[i+1][0]) //现在排名在后面的人语文成绩高
{
Exchange(id,sum,score,i,i+1);
}
else
{
if(score[i][0]==score[i+1][0]) //语文成绩相等
{
if(score[i][1]<score[i+1][1]) //后者数学成绩高
{
Exchange(id,sum,score,i,i+1);
}
else
{
i++;
}
//如果数学再相等,那么也不用交换了,由于总分相等
}
else
{
i++;
}
}
}
}
for(i=0;i<5;i++)
{
printf("%d%d ",id[i],sum[i]);
}


return0;
}

❷ 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语言有关的奖学金问题

#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语言高手进--奖学金问题

#define MAX 100
struct student /*定义学结构体*/
{ char name[20];
int study_m;
int class_m;
char gan;
char xi;
int number;
};
#include<stdio.h>
#include<string.h>
main ()
{
struct student student[MAX];
int ss[MAX];
int n; int i,s;
int sum=0;
int A_sum=0;
printf("Please input the number of the students:");
scanf("%d",&n); /*输入学生数*/
printf("\n");
printf("Please input the message of the student:\n");

for (i=1;i<=n;i++)
{
scanf("%s%d%d%s%s%d",student[i].name,&student[i].study_m,&student[i].class_m,&student[i].gan,&student[i].xi,&student[i].number); }

for(i=1;i<=n;i++) /*求每个学生的奖学金,存入对应的ss[i] */
{ sum=0;
if(student[i].study_m>80 && student[i].number>0)
sum+=8000;
if(student[i].study_m>85 && student[i].class_m>80)
sum+=4000;
if(student[i].study_m>90)
sum+=2000;
if(student[i].study_m>85 && student[i].xi=='Y')
sum+=1000;
if(student[i].class_m>80 && student[i].gan=='Y')
sum+=850;
ss[i]=sum;
A_sum+=ss[i]; /*总奖学金*/
}
sum=ss[1];s=1;
for(i=2;i<=n;i++) /*求最多奖学金的学生*/
{
if (sum<ss[i])
{ s=i;
sum=ss[i];
}
}

printf("\n%s\n",student[s].name);
printf("%d\n",ss[s]);
printf("%d\n",A_sum);
}

❺ c语言 谁拿了最多奖学金

1 #include <iostream>
2 using namespace std;
3 struct Stu{
4
char name[20];
5
int west;
6
int qimo;//��ĩ
7
int bj;//
8
int gb; //
9
int art; //����
10
int mo;
11 };
12 Stu stu[130];
13 int n;
14 long long money=0;
15 int main()
16 {
17
freopen("scholar.in","r",stdin);
18
freopen("scholar.out","w",stdout);
19
memset(stu,0,sizeof(stu));
20
cin >> n;
21
for(int i=1;i<=n;i++){
22
char a,b;
23
cin >> stu[i].name >> stu[i].qimo >> stu[i].bj >> a >> b >> stu[i].art;
24
if (a=='Y')stu[i].gb=1;
25
if (b=='Y')stu[i].west=1;
26
}
27
int bigm=0,jn;
28
for(int i=1;i<=n;i++){
29
if (stu[i].qimo>80 && stu[i].art)stu[i].mo+=8000;
30
if (stu[i].qimo>85 && stu[i].bj>80)stu[i].mo+=4000;
31
if (stu[i].qimo>90) stu[i].mo+=2000;
32
if (stu[i].qimo>85 && stu[i].west)stu[i].mo+=1000;
33
if (stu[i].bj>80 && stu[i].gb)stu[i].mo+=850;
34
money+=stu[i].mo;
35
if (stu[i].mo>bigm)bigm=stu[i].mo,jn=i;
36
}
37
cout << stu[jn].name << endl;
38
cout << bigm << endl;
39
cout << money << endl;
40
41
return 0;
42 }
43

❻ 谁会用C语言编辑一个奖学金程序急!

C++

#include <iostream>
#define FOR(i,a,b) for(i=a;i<b;i++)
using namespace std;

struct Student
{
char name[21];
int m1,m2;
char c1,c2;
int p,total;
};

int main( void )
{
int n,i,totals(0),max(0);
cin >> n;
struct Student* team = new Student[n],* tmax ;
FOR(i,0,n) {
cin >> team[i].name
>> team[i].m1 >> team[i].m2
>> team[i].c1 >> team[i].c2
>> team[i].p;
team[i].total = 0;
}
FOR(i,0,n) {
if (team[i].m1 > 80 && team[i].p > 0) team[i].total += 800;
if (team[i].m1 > 85 && team[i].m2 > 80) team[i].total += 400;
if (team[i].m1 > 90) team[i].total += 200;
if (team[i].m1 > 85 && team[i].c2 == 'Y') team[i].total += 100;
if (team[i].m2 > 80 && team[i].c1 == 'Y') team[i].total += 85;
totals += team[i].total;
}
max = team[0].total; tmax = &team[0];
FOR(i,1,n) if (team[i].total > max)
{max = team[i].total ; tmax = &team[i]; }
cout << tmax -> name << endl
<< tmax -> total << '0' << endl
<< totals << '0' << endl;
totals = max = 0;
delete [] team;
}

❼ c语言关于加权平均分计算奖学金的问题

手打的 但没编译检查是否正确- -~

#include <stdio.h>

#define KECHENG 12
#define JIANGJIN_LINE 82.13
#define JIGE 60
#define KEMU 12
#define TRUE 1
#define FALSE 0

void input_Num(int *Num)
{
printf("input Num \r\n");
scanf("%d",Num);
}

void input_Chengji(int *Xuefen,int *Chengji)
{
int i;
for(i=0;i<KEMU;i++)
{
printf("input No. %d Xuefen \r\n",i);
scanf("%d",&Xuefen[i]);
printf("input No. %d Chengji \r\n",i);
scanf("%d",&Chengji[i]);
}

}

int Sum_Xuefen(int *Xuefen)
{
int Result;
int i;
Result = 0;
for(i=0;i<KEMU;i++)
{
Result = Result + Xuefen[i];
}
return Result;

}

int Sum_Chengji(int *Chengji)
{
int Result;
int i;
Result = 0;
for(i=0;i<KEMU;i++)
{
Result = Result + Chengji[i];
}
return Result;

}

int Output_JiGeCheck(int *Chengji)
{
int i;
int Result;
Result = TRUE;
for(i=0;i<KEMU;i++)
{
if(Chengji[i]<60)
{
Result = FALSE;
break;
}
}
return Result;
}

void OutputResult()
{
int T;
int i;
int L;
int chengji[KEMU];
int xuefen[KEMU];
float MaxChengji;
float TempChengji;
MaxChengji = JIANGJIN_LINE;
L = 0;
input_Num(&T);
for(i=0;i<T;i++)
{
input_Chengji(&xuefen[0],&chengji[0]);
if(TRUE == Output_JiGeCheck(&chengji[0])
{
TempChengji = Sum_Chengji(&chengji[0])/Sum_Xuefen(&xuefen[0]);
}
if(TempChengji > JIANGJIN_LINE)
{
L++;
if(TempChengji > MaxChengji)
{
MaxChengji = TempChengji;
}

}
}
printf("%.2f , %d",MaxChengji,L);

}

❽ 求一个关于评定奖学金的c语言程序

#include "stdio.h"
main()
{float a[3];
int i,m,n,o,p,q,r;
m=n=o=p=q=r=0;
printf("input 3 scores:");
scanf("%f%f%f",&a[0],&a[1],&a[2]);
for(i=0;i<3;i++)
{if(a[i]>=85)
m++;
else if(a[i]<85&&a[i]>=80)
n++;
else if(a[i]<80&&a[i]>=75)
o++;
else if(a[i]<75&&a[i]>=70)
p++;
else if(a[i]<70&&a[i]>=65)
q++;
else if(a[i]<65&&a[i]>=60)
r++;
}
if(m==2&&n==1)
printf("first\n");
else if(m+n+o==2&&p==1)
printf("second\n");
else if(m+n+o+p+q==2&&r==1)
printf("third\n");
else
printf("no price\n");
}

❾ C语言结构体。。。每人有语数外三科成绩,算奖学金的问题 输入N表示有多少个学生 然后输入姓名

#include<stdio.h>
#include<string.h>
#include<algorithm>

using namespace std;

struct node
{
char ss[100];
double Chi,Eng,Math,sum;
};

bool cmp( node a, node b)
{
if( a.sum-b.sum>-0.0000001 && a.sum-b.sum-0.0000001)
return strcmp( a.ss, b.ss )<0;
return a.sum>b.sum;
}
int main()
{
node stu[1005];
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%s",stu[i].ss);
scanf("%lf%lf%lf",&stu[i].Chi,&stu[i].Eng,&stu[i].Math);
stu[i].sum=stu[i].Chi+stu[i].Eng+stu[i].Math;
}
sort( stu+1,stu+n+1,cmp);
for(int i=1;i<=3;i++)
printf("%s ",stu[i].ss);
return 0;
}


❿ 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语言代码相关的资料

热点内容
20132014南开大学国家奖学金名单 浏览:560
专升本考生考研复试 浏览:354
研究生给导师写自荐信被婉拒了怎么回复 浏览:470
2020中科大非全日制分数 浏览:747
江西非全日制研究生 浏览:1
2016全日制自考学校 浏览:86
考研广播电视学分数线 浏览:465
研究生什么年龄能考试 浏览:580
中科院大学研究生考试培训 浏览:43
全日制大专免考免试入学 浏览:943
考研在学校租房子 浏览:543
上海全日制专升本报名 浏览:924
事业单位必须是全日制学历吗 浏览:233
出国读研澳洲 浏览:340
金融研究生考英语考试 浏览:43
云南大学研究生比较好的专业 浏览:32
本科生考在职研究生报考时间 浏览:173
密码学专业考研科目 浏览:996
工程学院针对的考研的学校有哪些 浏览:982
研究生考试366分 浏览:123