📄 5-2.cpp
字号:
#include<iostream.h>
#include<iomanip.h>
void readdata (float score[10])
{
int i;
cout<<"enter 10 student's scores:\n";
for(i=0;i<10;i++)
cin>>score[i];
return ;
}
float aver(float score[10])
{
float sum;
int i;
for(sum=0,i=0;i<10;i++)
sum=sum+score[i];
return(sum/10);
}
void print(float score[10],float ave)
{
int i;
cout<<"the scores which are below the average:";
for(i=0;i<10;i++)
if(score[i]<ave)cout<<score[i];
return ;
}
void main()
{
void readdata(float score[10]);
float aver(float score[10]);
void print(float score[10],float ave);
float ave,score[10];
readdata(score);
ave=aver(score);
cout<<"average="<<ave<<endl;
print(score,ave);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -