Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

九度OJ 1018 统计同成绩学生人数

$
0
0

题目链接:http://ac.jobdu.com/problem.php?pid=1018


题目分析:

依次输入成绩到数组里,注意数组大小为1000,再比对给定成绩,得出人数。


源代码:

#include <iostream>
using namespace std;

int main()
{
	int n;
	while (cin>>n)
	{
		if (n == 0)
		{
			break;
		}
		int a[1000] = {0};	
		for (int i = 0; i < n; i++)
		{
			cin>>a[i];
		}
		int grade;
		cin>>grade;
		int j = 0;
		for (int i = 0; i < n; i++)
		{
			if (grade == a[i])
			{
				j++;
			}
		}
		cout<<j<<endl;
	}
	return 0;
}


作者:wh921021 发表于2013-5-20 0:03:42 原文链接
阅读:181 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>