#include<iostream.h>
void main()
{
double score[10];
double sum=0,average=0;
int num=0;
cout<<"请输入学生成绩:"<<endl;
for(int i=0;i<10;i++)
{
cout<<"第"<<i+1<<"位同学的成绩为:";
cin>>score[i];
}
for(int j=0;j<10;j++)
{
if(score[j]<60)
{
num=num+1;
}
sum=sum+score[j];
}
cout<<"总共有"<<num<<"位同学不及格!"<<endl;
cout<<"不及格人数占总人数的"<<num/10.0*100<<"%"<<endl;
average=sum/10;
cout<<"全班的平均分为:"<<average<<endl;
double max=score[0];
for(int k=0;k<9;k++)
{
if(max<score[k+1])
{
max=score[k+1];
}
}
cout<<"最优秀的成绩为:"<<max<<endl;
double min=score[0];
for(int l=0;l<9;l++)
{
for(int m=l+1;m<9;m++)
{
if(min>score[l+1])
{
min=score[l+1];
}
}
}
cout<<"最差成绩为:"<<min<<endl;
for(int n=0;n<10;n++)
{
cout<<score[n]<<"/t";
}
cout<<endl;
for(int y=1;y<=10;y++)
{
cout<<"请输入您要查询的学号:"<<endl;
cin>>y;
//cout<<"学号为:"<<y<<"同学的成绩为:"<<score[l]<<endl;
}
cout<<score[y]<<endl;
}
void main()
{
double score[10];
double sum=0,average=0;
int num=0;
cout<<"请输入学生成绩:"<<endl;
for(int i=0;i<10;i++)
{
cout<<"第"<<i+1<<"位同学的成绩为:";
cin>>score[i];
}
for(int j=0;j<10;j++)
{
if(score[j]<60)
{
num=num+1;
}
sum=sum+score[j];
}
cout<<"总共有"<<num<<"位同学不及格!"<<endl;
cout<<"不及格人数占总人数的"<<num/10.0*100<<"%"<<endl;
average=sum/10;
cout<<"全班的平均分为:"<<average<<endl;
double max=score[0];
for(int k=0;k<9;k++)
{
if(max<score[k+1])
{
max=score[k+1];
}
}
cout<<"最优秀的成绩为:"<<max<<endl;
double min=score[0];
for(int l=0;l<9;l++)
{
for(int m=l+1;m<9;m++)
{
if(min>score[l+1])
{
min=score[l+1];
}
}
}
cout<<"最差成绩为:"<<min<<endl;
for(int n=0;n<10;n++)
{
cout<<score[n]<<"/t";
}
cout<<endl;
for(int y=1;y<=10;y++)
{
cout<<"请输入您要查询的学号:"<<endl;
cin>>y;
//cout<<"学号为:"<<y<<"同学的成绩为:"<<score[l]<<endl;
}
cout<<score[y]<<endl;
}