So I am writing this program that is supposed to take input from the user, on how many students are in a section, and calculate their grades accordingly.
Here's an example of the input:
5 81 91 93 78 63
The 5 corresponds to the number of students, and the next 5 numbers are the scores. How do I handle the 5 scores? I am a bit confused. I have to assign a letter grade to each score, and don't understand how. I understand the logic for assigning letter grades, but I am not sure how to handle a dynamic number of students. Also, the user will input a different number for the amount of students every time. Any help would be appreciated.
You could use std::vector to solve this pretty well. If you wanted to get fancy, you could define a data structure that holds each students grade percent and letter, and store it all in a single vector
As ResidentBiscuit said, you can use a std::vector to store the scores, or simply gather the input in a loop one score at a time and output the corresponding grade if you aren't that far along yet.