0

I'm really struggling with this assignment. Here's what I have to do:
Write a program that uses an array to store 10 elements, representing 10 students' test scores that will be entered from the keyboard. Given the following grading scale (given in my if statements) determine the letter grade each score will receive, and store the grade in a corresponding character array.
Display the numeric score and the corresponding letter grade. Also calculate and display the class averagee as well as the number of students that receive each letter grade. Everything must be done in main.

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
    int scores[10],
        average = 0;
    double score = 0;

    for ( int i = 0; i < 10; i++ )
    {
        cout << "Enter Student #" << i + 1 << "'s score: ";
        cin >> scores[i];

     if ( score >= 92.0 ) 
        cout << score << " You received an A" <<'\n';
        else
            if ( score >= 84.0 && score < 92.0 )
                cout << score << " You received a B" <<'\n';
            else
                if ( score >= 75.0 && score < 84.0 )
                    cout << score << " You received a C" <<'\n';
                else
                    if ( score >= 65.0 && score < 75.0 )
                        cout << score << " You received a D" <<'\n';
                    else
                        if ( score < 65.0 && score < 65.0 )
                            cout << score << " You received an F" << '\n'; 
    }

    return 0;
}
2
Contributors
1
Reply
16
Views
3 Years
Discussion Span
Last Post by Moschops
0

I don't see you storing the grade in a char array.

 if ( score >= 92.0 ) 
 {
   grade[i] = 'A';
 }

and so on.

Edited by Moschops

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.