after a lot of fussing, my code finally compiles properly.

but once again, its not calculating the things i want.
PROBLEM:
doesnt calculate "scores entered by user"
doesnt calculate "highest max score"
doesnt calculate "lowest min score"

as far as the scores entered by user...
i was hoping this..
if user entered 99, 88, 77, 66, etc, it would show up just as is...
like... Scores entered: 99 88 77 66

it worked before with my old program, and im trying to match it with an older program of mine, and it would give me errors. so i just stuck with it and decided to ask for help.

anyway, i apologize for the lengthy INT MAIN. my teacher doesnt want subprograms in this one, soo the int main is lengthy as heck!

anyway, if someone can take a look and spy whats wrong, thank u

``````#include <fstream>
#include <iostream>
using namespace std;

// STRUCTure
struct Score
{
int value;
};

// main hub for all
int main()
{

// prompt for how many students
int nScores;
cout << "How many scores would you like to view? ";
cin >> nScores;
cin.ignore(1000, 10);
cout << " " << endl;

// read and save the scores
for (int count = 0; count < nScores; count++)
{
Score* aScore = new Score;
cout << "Enter score: ";
cin >> aScore->value;
cin.ignore(1000, 10);

}

// traverse list
int sum = 0;
int count = 0;
Score* p;
for (p = head; p; p = p->next)
{
sum += p->value;
count++;
}

// print results
if (count > 0)
{
float average = float(sum) / nScores;
cout << "The average of " << nScores << " scores is " << average << endl;
}

// print the scores entered
cout << "Scores entered: ";
cout << count << ' ';
cout << endl;

// print the max and min scores
int aScore;
int max = aScore;
int min = aScore;
for (count = 0; count < aScore; count++)
{
if (max < aScore) max = aScore;
if (min > aScore) min = aScore;
}

cout << " " << endl;
cout << "highest score: " << max << endl;
cout << "lowest score: " << min << endl;

// count# of scores that are A,B,C,passing grades
for (p = head; p; p = p->next)
{
}
cout << "Number of A scores: " << nAgrade <<  endl;

for (p = head; p; p = p->next)
{
if (p->value >= 80 && p->value < 90) nBgrade++;
}
cout << "Number of B scores: " << nBgrade <<  endl;

for (p = head; p; p = p->next)
{
if (p->value >= 70 && p->value < 80) nCgrade++;
}
cout << "Number of C scores: " << nCgrade <<  endl;

int nPassing = 0;
for (p = head; p; p = p->next)
{
if (p->value >= 70 && p->value <= 100) nPassing++;
}
cout << "Number of passing scores: " << nPassing <<  endl;

cin.ignore();
cin.get();
return 0;
}``````
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.