Multiple input/outputs.

Hello, with me is an assignment where am to create a code that can receive 10 grades and then give a grading letter attached to it accordingly as an output. I have worked on this code but on trying to run it does not give the expected input/ output which should be in multiples. Am only getting output as listed below:
Included is the code that I prepared.
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.


#include <iostream>
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';
}
}
.
the expected input/ output which should be in multiples.

Do not understand what you mean by "multiples".

The output you posted does not match your program. Your listed output is in lower case. Your program outputs upper case.

PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <> formatting button.
Do you mean something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <iostream>

constexpr size_t NoGrades {10};

char getLetter(double);

int main() {
	double grades[NoGrades]{};

	for (size_t g = 0; g < NoGrades; ++g) {
		std::cout << "Enter mark for student " << g + 1 << ": ";
		std::cin >> grades[g];
	}

	std::cout << '\n';

	for (const auto& g : grades)
		std::cout << g << "=" << getLetter(g) << '\n';
}

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';

	return 'X';
}



Enter mark for student 1: 95
Enter mark for student 2: 100
Enter mark for student 3: 99
Enter mark for student 4: 96
Enter mark for student 5: 98
Enter mark for student 6: 97
Enter mark for student 7: 94
Enter mark for student 8: 94.5
Enter mark for student 9: 90
Enter mark for student 10: 88

95=A
100=A
99=A
96=A
98=A
97=A
94=B
94.5=B
90=B
88=C

Topic archived. No new replies allowed.