Please send questions to
st10@humboldt.edu .
/*--------------------------------------------------
File: countPassing.cpp
Name: Sharon M. Tuttle
last modified: 5-3-05
Contract: countPassing : double[] int -> double
Purpose: returns how many grades amongst the first
size elements of array grades are 73.0 or
higher.
Examples: for double grades[10] =
{76.5, 88.0, 99.6, 66, 43.0, 93.2, 73.0,
72.0, 74.0, 95},
countPassing(grades, 10) == 7
--------------------------------------------------*/
#include <iostream>
#include <cmath>
#include "countPassing.h"
using namespace std;
double countPassing(const double grades[], int size)
{
double passCt = 0;
// count each passing grade encountered
for (int i=0; i < size; i++)
{
if (grades[i] >= PASSING_GRADE)
{
passCt++;
}
}
return passCt;
}