1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
#include <iostream>
using namespace std;
void processArrary(int numberCount[], int Numbers[], int intnumberSize, int numberCountSize);
int main()
{
int Scores[26] = {76, 89, 150, 135, 200, 76, 12, 100, 150, 28, 178, 189, 167, 200, 175, 150, 87, 99, 129, 149, 176, 200, 87, 35, 157, 189};
int numberCount[8] = { 0 };
processArrary(Scores, numberCount, 8, 26);
cout << "The Number of Students between 0 and 24 is: " << numberCount[0]<< endl;
cout << "The Number of Students between 25 and 49 is: " << numberCount[1]<< endl;
cout << "The Number of Students between 50 and 74 is: " << numberCount[2]<< endl;
cout << "The Number of Students between 75 and 99 is: " << numberCount[3]<< endl;
cout << "The Number of Students between 100 and 124 is: " << numberCount[4]<< endl;
cout << "The Number of Students between 125 and 149 is: " << numberCount[5]<< endl;
cout << "The Number of Students between 150 and 174 is: " << numberCount[6]<< endl;
cout << "The Number of Students between 175 and 200 is: " << numberCount[7]<< endl << endl;
system("pause");
return 0;
}
void processArrary(int Numbers[], int numberCount[], int intnumberSize, int numberCountSize = 0)
{
for (int j = 0; j < intnumberSize; j++)
{
if (Numbers[j] < -1 && Numbers[j] > 25)
{
numberCountSize = numberCountSize ++;
numberCount[0] = numberCountSize;
}
else
if (Numbers[j] < 25 && Numbers[j] > 50)
{
numberCountSize = numberCountSize ++;
numberCount[1] = numberCountSize;
}
else
if (Numbers[j] < 50 && Numbers[j] > 75)
{
numberCountSize = numberCountSize ++;
numberCount[2] = numberCountSize;
}
else
if (Numbers[j] < 75 && Numbers[j] > 100)
{
numberCountSize = numberCountSize ++;
numberCount[3] = numberCountSize;
}
else
if (Numbers[j] < 100 && Numbers[j] > 125)
{
numberCountSize = numberCountSize ++;
numberCount[4] = numberCountSize;
}
else
if (Numbers[j] < 125 && Numbers[j] > 150)
{
numberCountSize = numberCountSize ++;
numberCount[5] = numberCountSize;
}
else
if (Numbers[j] < 150 && Numbers[j] > 175)
{
numberCountSize = numberCountSize ++;
numberCount[6] = numberCountSize;
}
else
if (Numbers[j] < 175 && Numbers[j] > 200)
{
numberCountSize = numberCountSize ++;
numberCount[7] = numberCountSize;
}
}
}
|