當前位置:首頁 » 考試成績 » 成績最高的學生

成績最高的學生

發布時間: 2020-11-29 01:18:09

① C語言輸出三個學生中成績最高的學生的成績

輸入可以改為:

scanf("%s%d%d%c",stu[0].name,&stu[0].number,&stu[0].score,&stu[0].sex);




注意:

1.scanf內不能有

2.注意輸入的類型(你的number為int類型,輸入時為%d)

3.類型為%s的時候,後面的stu[0].name前就不需要加上取地址符&了


輸入順序改為上述之後,輸入時依次為:

1.輸入姓名字元串,以回車結束

2.接著輸入一個整數表示學號,以空格,或tab鍵,或回車結束

3.再輸入一個整數表示成績,以下一個要輸入的字元(即表示的是性別)結束

4.性別在3中已經輸入,此時直接回車結束整個輸入。


一般的,當一次性要輸入好幾個不同類型的數據時,字元型的一般最後輸入。(此題中如果學號為字元串類型,亦不影響輸入的結果,只是此時只能輸入一個字元串代表學號後以回車結束了)

② SQL查詢每課成績最高的學生的信息

select
distinct
*
from
(
select
需要抽取的欄位
from
學生成績內表容
a
where
a.語文
=
(select
max(語文)
from
學生成績表)
union
all
select
需要抽取的欄位
from
學生成績表
a
where
a.數學
=
(select
max(數學)
from
學生成績表)
union
all
select
需要抽取的欄位
from
學生成績表
a
where
a.英語
=
(select
max(英語)
from
學生成績表)
。。。)
b
如果需要包含學科成績,那還要做處理。

③ C語言學生成績最高平均

下面的程序先輸入10個學生的數據,輸入三門課的成績完成後,計算每位學生的總分以及平均分。然後找出最高分學生。最後輸出最高分學生的數據,還有三門課的總平均成績。

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

#defineN10
structstu
{
intgrade[3];
charname[10];
charnumber[10];
intsum;
doubleave;
};

voidf_input(structstu*temp);
structstuf_max(structstu*temp);
voidf_print(structstus);
voidf_print_ave(structstu*temp);

intmain()
{
structstus[N];
structstus_max;

f_input(s);
s_max=f_max(s);
printf(" thesummaxis: ");
f_print(s_max);
f_print_ave(s);
return0;
}
voidf_input(structstu*temp)
{
inti;
intj;

for(i=0;i<N;i++)
{
intsum=0;
printf("pleaseinput%dstudentname: ",i+1);
scanf("%s",temp->name);
printf("pleaseinput%dstudentnumber: ",i+1);
scanf("%s",temp->number);
for(j=0;j<3;j++)
{
printf("pleaseinput%dgrade: ",j+1);
scanf("%d",&temp->grade[j]);
sum+=temp->grade[j];
}
temp->sum=sum;
temp->ave=sum/3.0;
temp++;
}
}
structstuf_max(structstu*temp)
{
structstu*max;
inti;

max=temp;
for(i=0;i<N;i++)
{
if((temp->sum)>(max->sum))
{
max=temp;
}
temp++;
}
return*max;
}
voidf_print(structstus)
{
inti;
printf("thestudentnameis:%s ",s.name);
printf("thestudentnumberis:%s ",s.number);
for(i=0;i<3;i++)
{
printf("thegrade[%d]is:%d ",i+1,s.grade[i]);

}
printf("thesumis:%d ",s.sum);
printf("theaverageis:%f ",s.ave);
}
voidf_print_ave(structstu*temp)
{
inti;
intsum_all=0;
doubleave_all;
for(i=0;i<N;i++)
{
sum_all+=temp->sum;
temp++;
}
ave_all=sum_all/(3.0*N);
printf(" theaverageofallgradesis:%f ",ave_all);
}

我跑過程序了,應該沒錯的,就是輸入學生信息的時候,由於有10位學生,可能輸入的信息比較多。先輸入姓名,然後是學號,最後是三門課程的成績。每次輸入完成後回車就可以了。可以自己跑一下程序,就看到結果了。

④ 用sql 查詢出各個科目中成績最好的學生的名字

select
姓名
from
(select
*
from
(
select
a.學生編號,a.姓名
b.
學生編號,b.科目,b.分數
from
table1
a
right
join
table2
b
on
b.學生編號=a.學生編號
)c
group
by
c.科目
having
max(c.分數)
)

⑤ 每個學生有不同成績,sql查詢最高成績的排名

1.每個學生可以是參加了一次或者多次的考試,對吧?
2.你是使用什麼資料庫?版MySQL?Oracle?SQLServer?
3.若學生中權最高的成績都是相同的分數,如何排名?是給相同的名次還是依舊隨機增序的方式排序?

⑥ 世界上分數最高的學生過得好嗎

過得好。。。

⑦ 有4名學生,每個學生包括學號、姓名、成績,要求找出成績最高者的姓名和學號

求:① 編寫類的定義。
② 編寫主函數使用這個類。

****************************/

#include <iostream>

using namespace std;

#define pi 3.1415926

class CCircle
{
public:
double getArea(double radius);
double getGirth(double radius);
private:
double radius;
};

double CCircle::getArea(double radius)
{
return pi * radius * radius;
}

double CCircle::getGirth(double radius)
{
return 2 * pi * radius;
}

int main()
{
CCircle circle;
float radius;
double area,girth;
cout << " 請輸入圓半徑:" << endl;
cin >> radius;
area = circle.getArea(radius);
girth = circle.getGirth(radius);
cout << "半徑\t" << "面積\t" << "周長\t" << endl;
cout << radius << "\t" << area << "\t" << girth << "\t" << endl;

return 0;
}

/**********************************\
7.1、有4名學生,每個學生的數據包括學號、姓名、成績,要求找出成績最高者的學號、姓名和成績,並輸出。
要求:① 寫出源程序,上機編輯、調試、運行程序
② 從鍵盤輸入測試數據,寫出運行結果
\**********************************/

#include <iostream>
#include <string>

using namespace std;

class Cstu
{
public:
void getInf();
void sort(string name[],string num[],float score[]);
private:
string name[4];
string num[4];
float score[4];
};

void Cstu::getInf()
{
cout << "請輸入學生的姓名和學號和成績:" << endl;
cout << "姓名\t" << "學號\t" << "成績\t" << endl;
for(int i = 0;i < 4;i++)
{
cin >> name[i] >> num[i] >> score[i];
}
}

void Cstu::sort(string name[],string num[],float score[])
{
int n,i;
float temp = 0;
for(i = 0;i < 4;i++)
{
if(score[i] > temp)
{
temp = score[i];
n = i;
}
}
cout << "最高分的信息是;" << endl;
cout << name[i] << "\t" << num[i] << "\t" << score[i] << endl;
}

int main()
{
Cstu stu;
stu.getInf();
stu.sort(stu.name,stu.num,stu.score);
// stu.sort();

getchar();

return 0;
}

呵呵,這個問題想錯了。應該是這樣定義的:Cstu stu[4]
前面的函數都錯了!

⑧ 麥元中學中考學生成績最高分學生是誰

2009年望江縣中考成績2009年中考成績已揭曉,全縣共8540人參加了初中畢業學業考試,其中最高分742.5分(麥元版中學考生權)、700分以上118人、650分以上894人、600分以上2293人、550分以上3606人、500分以上4829人,450分以上5819人。從成績分布情況看,今年700分以上學生分布較廣,幾乎覆蓋所有初中,總成績前10名的考生分別分布在麥元中學、實驗學校、鴉灘初中、文凱學校、望江初中、長江學校等學校。

⑨ MySQL查詢成績最高的學生及分數(兩張表)

參考sql如下:

⑩ c語言篩選成績最高學生

//學生信息結構體
structStudentInfo
{
charm_chNo[8];//學號
doublem_dMath;//數學成績
doublem_dEng;//英語成績
doublem_dComp;//計算機成績
doublem_dAve;//平均成績
};

//計算平均成績
voidave(StudentInfo&st)
{
st.m_dAve=(st.m_dMath+st.m_dEng+st.m_dComp)/3.0;
}

//尋找最高平均成績的學生
intfind(StudentInfo*pStudents,intnCount)
{
intnResult=-1;
if(nullptr==pStudents||nCount<1)
returnnResult;

doubledMax=0.0;
for(inti=0;i<nCount;i++)
{
if(pStudents[i].m_dAve>dMax)
{
dMax=pStudents[i].m_dAve;
nResult=i;
}
}

returnnResult;
}

int_tmain(intargc,_TCHAR*argv[])
{
//輸入學生總數
intnCount=0;
scanf("%d",&nCount);
if(nCount<1)
return0;

//依次輸入學生信息
StudentInfo*pStudents=(StudentInfo*)malloc(sizeof(StudentInfo)*nCount);
for(inti=0;i<nCount;i++)
{
scanf("%s%lf%lf%lf",&(pStudents[i].m_chNo),&(pStudents[i].m_dMath),
&(pStudents[i].m_dEng),&(pStudents[i].m_dComp));
ave(pStudents[i]);
}

//尋找最高平均成績
intnPos=find(pStudents,nCount);
if(-1==nPos)
return0;

//列印最高平均成績學生信息
printf("%-8s%-8s%-8s%-8s%-8s ","No","Math.","Eng.","Comp.","Ave.");
printf("%-8s%-8.2f%-8.2f%-8.2f%-8.2f",pStudents[nPos].m_chNo,pStudents[nPos].m_dMath,
pStudents[nPos].m_dEng,pStudents[nPos].m_dComp,pStudents[nPos].m_dAve);

//釋放內存
free(pStudents);
system("pause");
return0;
}

熱點內容
武漢大學學生會輔導員寄語 發布: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