概述
Submit: 553 Solved: 432
[Submit][Status][Web Board]
Description
设一维数组存放了n(<100)个学生的成绩,编写函数求不及格的人数
部分代码已给定如下,只需要提交缺失的代码。
#include <iostream>
using namespace std;
int main()
{
float score[100];
int i,num=0,n;
int failcnt(float score[],int n);
cin>>n;
for(i=0; i<n; i++)
{
cin>>score[i];
}
num=failcnt(score,n);
cout<<num<<endl;
return 0;
}
Input
n和n个学生的成绩
Output
不及格的人数
Sample Input
10
90 85 50 45 70 76 92 69 83 89
Sample Output
2
HINT
한국어 中文 فارسی English ไทย
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2014 HUSTOJ TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin
All Copyright Reserved 2010-2014 HUSTOJ TEAM
GPL2.0 2003-2014 HUSTOJ Project TEAM
#include <iostream>
using
namespace
std;
int
main()
{
float
score[100];
int
i,num=0,n;
int
failcnt(
float
score[],
int
n);
cin>>n;
for
(i=0; i<n; i++)
{
cin>>score[i];
}
num=failcnt(score,n);
cout<<num<<endl;
return
0;
}
int
failcnt(
float
score[],
int
n)
{
int
s=0,i;
for
(i=0;i<n;i++)
if
(score[i]<60)
s++;
return
s;
}
最后
以上就是老迟到小蜜蜂为你收集整理的Problem C: 统计不及格人数的全部内容,希望文章能够帮你解决Problem C: 统计不及格人数所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复