I need to write a program that reads a file consisting of students' tests scores in the range of 0-200. I need to break them into ranges :0-24, 25-49, 50-74, 75-99, 100-124, 125-149, 150-174, and 175-200. Then I need to Output the score ranges of the students. Also I nee to output the scores from the file so 5 elements/scores appear per line.
This is what I have

int main()
{
	ifstream in;
	ofstream out;
	
	in.open("g:\\scoresIn.txt");
	out.open("g:\\scoresOut.txt");

	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; (These are the scores I need to use in this order)

	
	scores[26] == scores[26]<24 ? in : in;


	in.close();
	out.close();
	
return 0;
}

PLEASE HELP

>>scores[26] == scores[26]<24 ? in : in;
I have no clue what that is trying to do

There are 8 sets of values that the scores can fall into, not 32. So all you need is an array of 8. When you read a score just use a series of if statements to determine which of the 8 array elements it will fall into

int scores[8] = {0}; // initialize all elements to 0

// for each value read from the file, do this:
    if( value < 25) 
        score[0]++;
   else if( value < 50)
        score[1]++;
   else if( value < 75)
        score[2]++;
   // etc. etc for all remaining ranges
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.