當前位置:首頁 » 成績查詢 » 編寫程序對成績排名

編寫程序對成績排名

發布時間: 2021-02-19 00:41:59

㈠ 用C語言編輯程序 成績排名次——要按提示的編啊

我有空給你,還是好編的

㈡ 請幫我寫一下製作學生成績排名的c語言編程可以嗎 十萬火急謝謝

這是我以前用c語言寫的,如果需要我把源代碼發你郵箱!

㈢ C語言編程序對學生成績排名

#include int main(){ float score = 0f; printf("請輸入成績:\n"); scanf("%f", &score); switch ((int)score / 10) { case 10: case 9: printf("優秀\n"); break; case 8: printf("良好\n"); break; case 7: printf("中等回\n"); break; case 6: printf("及格答\n"); break; default : printf("不及格\n"); break; } return 0;}

㈣ 編寫程序求9個同學的平均分,並對成績由低到高排序

#include <stdio.h>
#include <malloc.h>

typedef struct st
{
char name[20];
int chinese;
int math;
int english;
float average;
}student;

void swap(student *a, student *b)
{
student temp = *a;
*a = *b;
*b = temp;
}

void sort(student *array, int n)
{
int i, j, flag;
for (i = 0; i < n - 1; i++)
{
flag = 1;
for (j = 0; j < n - i - 1; j++)
{
if (array[j].average > array[j + 1].average)
{
swap(array + j, array + j + 1);
flag = 0;
}
}
if (flag)
break;
}
}

void print(student *array, int n)
{
int i;
printf("姓名 語文 數學 英語 平均成績 ");
for (i = 0; i < n; i++)
{
printf("%s %d %d %d %f ", array[i].name, array[i].chinese,
array[i].math, array[i].english, array[i].average);
}
}

int main()
{
int number = 9;
int i;
student *stu = (student *)malloc(sizeof(student) * 9);
for (i = 0; i < number; i++)
{
printf("請輸入第%d個學生的姓名及成績(姓名 語文 數學 英語成績以空格隔開): ", i + 1);
scanf("%s %d %d %d", (*(stu + i)).name, &(*(stu + i)).chinese,
&(*(stu + i)).math, &(*(stu + i)).english);
(*(stu + i)).average = ((*(stu + i)).chinese +
(*(stu + i)).math + (*(stu + i)).english) / (float)3.0;
}
print(stu, number);
sort(stu, number);
print(stu, number);
free(stu);
return 0;
}

㈤ c語言成績排名(詳細點)

#include <stdio.h>

int Input(int score[])
{ int i=0;
int x;

scanf("%d",&x);
while(i<70&&x!=-1)
{
score[i]=x;i++;
scanf("%d",&x);
}
return i;
}

void Sort(int a[],int n)
{
int i,j;
int flag;

for(i=n-1;i>=1;i--)
{flag=0;
for(j=0;j<n-1;j++)
if(a[j]<a[j+1]){int t=a[j];a[j]=a[j+1];a[j+1]=t;flag=1;}
if(flag==0) break;
}
}

void Output(int score[],int n)
{
int i;
for(i=0;i<n;i++)
if((i+1)%5==0) printf("%4d\n",score[i]);
else printf("%4d",score[i]);
}

int main( )
{
int s[70],n;
n=Input(s);
Sort(s,n);
Output(s,n);
return 1;
}
程序沒有調試,原理應該沒有錯,將就用吧。

㈥ 編寫程序,對學生成績排序,名字與學號都要有

網路搜:C語言實戰之學生成績管理系統

㈦ 編寫一個程序,提示用戶輸入學生個數,學生姓名和他們的成績,然後按照學生成績的降序列印學生成績的排行榜.

import java.util.Arrays;
import java.util.Scanner;

public class Test {
public static void main(String[] args) {
reader = new Scanner(System.in);
System.out.println("請輸入學生個數");
String strStuNum = reader.nextLine();
int stuNum = Integer.parseInt(strStuNum);
String[] sNames = new String[stuNum];
int[] sScore = new int[stuNum];
for(int i = 0;i < stuNum; i++){
System.out.println("請輸入第"+(i+1)+"個學生的姓名");
sNames[i] = reader.nextLine();
System.out.println("請輸入"+sNames[i]+"的分數");
sScore[i] = Integer.parseInt(reader.nextLine());
}
int tempScore;
String tempName;
for (int i = stuNum - 1; i > 0; --i) {
boolean isSort=false;
for (int j = 0; j < i; ++j) {
if (sScore[j + 1] < sScore[j]) {
tempScore = sScore[j];
tempName = sNames[j];
sScore[j] = sScore[j + 1];
sNames[j] = sNames[j + 1];
sScore[j + 1] = tempScore;
sNames[j + 1] = tempName;
isSort=true;
}
}
if(!isSort)break;
}
for(int i = stuNum - 1; i >= 0;i--){
System.out.println("第"+(stuNum - i)+"名\t"+sNames[i]+"\t"+sScore[i]);
}
}
}

㈧ 用VC++6.0寫程序 成績排名

留個郵箱,做好了發給你

㈨ 設有10個學生的高考成績總分,見下表,編寫程序,按成績排名次並從窗體上輸出,要求輸出名次、姓名、成績。

#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <string.h>
const int studentNum=4; //學生數目
const int nameLen=20; //學生姓名長度
const int idLen=15; //學生學號長度
int main()
{
char name[studentNum][nameLen]; //學生姓名
char id[studentNum][idLen]; //學生學號
float score[studentNum][4]; //學生成績
float sum;
float average[studentNum]; //平均成績

int i,j;
/*******讀入學生的姓名、學號、成績和計算平均成績**********/
cout <<"請輸入"<<studentNum<<"個" <<"學生資料:" <<endl;
cout <<"格式為:姓名 學號 成績1 成績2 成績3 總分" <<endl;
for(i=0;i<studentNum;i++)
{
cin >>name[i] >>id[i];
sum=0;
for(j=0;j<4;j++)
{
cin >>score[i][j];
}
for(j=0;j<3;j++)
{
sum+=score[i][j];
}
average[i]=sum/3;
cout <<average[i] <<endl;
}
/******按照學生成績排序************/
int max; //排序,記錄當前一趟排序的最大值
for(i=0;i<studentNum-1;i++)
{
max=i; //假定第i個元素是最大值
for(j=i+1;j<studentNum;j++)
{
if(average[j]>average[max])
max=j;
}
/***將找到的具有最大值的元素放到當前一趟排序的第一個位置***/
if(i!=max)
{
float tempFloat;
char tempStr[nameLen];
/***交換兩個位置成績****/
tempFloat=average[i];
average[i]=average[max];
average[max]=tempFloat;
for(j=0;j<4;j++){
tempFloat=score[i][j];
score[i][j]=score[max][j];
score[max][j]=tempFloat;}
/***交換兩個位置的學生姓名***/
strcpy(tempStr,name[i]);
strcpy(name[i],name[max]);
strcpy(name[max],tempStr);
/****交換兩個位置的學號***/
strcpy(tempStr,id[i]);
strcpy(id[i],id[max]);
strcpy(id[max],tempStr);
}
}
/*****輸出排序後的結果******/
cout <<endl <<"排序後的結果為:" <<endl;
for(i=0;i<studentNum;i++){
cout <<name[i] <<" " <<id[i]<<" "<<score[i][0]<<" "<<score[i][1]<<" "<<score[i][2]<<" "<<score[i][3]<<" "<<endl;
}
system("pause");
return 0;
}
這是我給另一個人的,你自己改下吧

熱點內容
武漢大學學生會輔導員寄語 發布:2021-03-16 21:44:16 瀏覽:612
七年級學生作文輔導學案 發布:2021-03-16 21:42:09 瀏覽:1
不屑弟高考成績 發布:2021-03-16 21:40:59 瀏覽:754
大學畢業證會有成績單 發布:2021-03-16 21:40:07 瀏覽:756
2017信陽學院輔導員招聘名單 發布:2021-03-16 21:40:02 瀏覽:800
查詢重慶2018中考成績查詢 發布:2021-03-16 21:39:58 瀏覽:21
結業考試成績怎麼查詢 發布:2021-03-16 21:28:40 瀏覽:679
14中醫醫師資格筆試考試成績查分 發布:2021-03-16 21:28:39 瀏覽:655
名著賞析課程標准 發布:2021-03-16 21:27:57 瀏覽:881
北京大學商業領袖高端培訓課程 發布:2021-03-16 21:27:41 瀏覽:919