Here is my problem:

Write a program that reads in a set of positive integers, representing test scores for a class, and outputs how many times a particular number appears in the list. You may assume that the data has a set at most 100 numbers and that -999 marks the end of the input data. The numbers must be output in increasing order: Example data:

55 80 78 92 95 55 78 53 92 65 78 95 85 92 85 95 95

output should look like:

Test Score Count

53 1

55 2

65 1

78 3

80 1

85 2

92 3

95 4

I started trying and am completely lost first I am trying just to get the data stored and to print out in order, not trying to do any kinda count yet until I can store and sort the data. This is what I have done but I know it isn't even close: I am not completely sure how arrays work just yet:

Code:

#include <iostream>
using namespace std;
void testSort(int list[], int length);
void fillArray(int list[], int length);
void initialize(int list[], int length);
int main ()
{
int test[100];
int i;
int lengthx;
int score = 0;
int length = 100;
cout << "Enter how many test scores will be entered:";
cin >> lengthx;
cout << endl;
initialize(test, length);
cout << "Enter " << lengthx << " test scores: ";
fillArray(test, lengthx);
testSort(test, lengthx);
for ( i = 0; i < length; i++)
cout << test[i] << " ";
cout << endl;
return 0;
}
void testSort(int list[], int length)
{
int temp;
int iteration;
int index;
for (iteration = 0; iteration < length; iteration++)
{
for (index = 0; index < length - iteration; index++)
if (list[index] > list[index + 1])
{
temp = list[index];
list[index] = list[index+1];
list[index + 1] = temp;
}
}
}
void fillArray(int list[], int length)
{
int index;
for (index = 0; index < length; index++)
cin >> list[index];
}
void initialize(int list[], int length)
{
int index;
for (index = 0; index < length; index++)
list[index] = 0;
}