### How to have multiple input and multiple output Hi, we were given the task to create a program where the user has to input 10 grades and the output is supposed to give the corresponding grading letter. I have tried and make the code for it but I can't seem to create the multiple input and multiple output. Below is the sample input and output and my code.

Input:
95
100
99
96
98
97
94
94.5
90
88

output:
95=a
100=a
99=a
96=a
98=a
97=a
94=b
94.5=b
25=x
88=c

 ``123456789101112131415161718192021222324252627282930313233343536`` `````` #include using namespace std; char getLetter(double); int main (){ double Numgrade; cin >> Numgrade; cout << Numgrade << "=" << getLetter(Numgrade); return 0; } char getLetter (double grade){ if (grade >= 95 && grade <= 100){ return 'A'; } if (grade >= 90 && grade <= 94.99){ return 'B'; } if (grade >= 85 && grade <= 89){ return 'C'; } if (grade >= 80 && grade <= 84){ return 'D'; } if (grade >= 75 && grade <= 79){ return 'E'; } if (grade >= 40 && grade <= 74){ return 'F'; } else{ return 'X'; } } ``````  @noir, how do you do things multiple times? ... You use a loop!

Put a simple for-loop around lines 7 and 8. ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657`` ``````#include using namespace std; char getLetter(double); int main () { double Numgrade{0}; int grade_list; for(int i = 0; i < 10; i++) { cin >> Numgrade; grade_list[i] = Numgrade; } for(int i = 0; i < 10; i++) { cout << grade_list[i] << "=" << getLetter(grade_list[i]) << '\n'; } return 0; } char getLetter (double grade) { if (grade >= 95) { return 'a'; } if (grade >= 90) { return 'b'; } if (grade >= 85) { return 'c'; } if (grade >= 80) { return 'd'; } if (grade >= 75) { return 'e'; } if (grade >= 40) { return 'f'; } else { return 'x'; } }``````

 ``` 95 100 99 96 98 97 94 94.5 90 88 95=a 100=a 99=a 96=a 98=a 97=a 94=b 94=b 90=b 88=c Program ended with exit code: 0 ``` @againtry is there any substitution to what you use? I still havent encountered those kind of variables that uses [] as well as {}. If its okay may I know what they do? @noir234
`double Numgrade{0};`
is equivalent to what you are probably used to, ie `double Numgrade = 0`; The curly braces were brought in to make initialization uniform with other variable declarations.

The square brackets are used in this case for an array (multiple) of items because your assignmnet description says to have multiple input and multiple output. You pile in a batch (array) of numbers, and then the program spits out the answers, one at a time. 