something like this should work...
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string temp;
int grades[100]={0};
int counter=0;
ifstream file("c:/temp/temp.txt");
while(!file.eof() )
{
getline(file, temp);
grades[counter++] = atoi( temp.c_str() );
}
file.close();
for (int index=0; index < counter; index++)
cout << grades[index] << '\t';
cout << endl << endl;
int freq[100] = {0};
for (int x=0; x < 100; x++)
{
int temp = grades[x];
if (temp > 0)
freq[temp] += 1;
}
for(int y=0; y < 100; y++)
if (freq[y] > 0)
cout << "There were " << freq[y] << " students who got " << y << '%' << endl;
system("PAUSE");
}