Suppose we have to write a program where a mark out of 60 is entered and then the corresponding symbol has to be displayed. A message indicating whether the person has passed or not, should also be displayed. We decide to write the program in three steps. You should submit the program and out of Question 1c only.
Question 1a:
We give the main function below. Your task is to write a function, namely letters, of type char. It receives in a parameter of type int and returns a letter of the alphabet. The symbol is determined as follows:
Mark Character
0 – 39 F or f
40 – 49 E or e
50 – 59 D or d
60 – 69 C or c
70 – 79 B or b
80 – 100 A or a
Test your program with several input values
#include<iostream>
using namespace std;
// the required function prototype should be inserted here
int main()
{
int mark;
char ch;
cout << “Enter the mark out of 60: ”;
cin >> mark;
ch = letters(mark);
cout << “Symbol corresponding to ” << mark << “ is ”
<< ch << endl;
return 0;
}
Question 1b:
Now you should write another value-returning function, namely passOrNot of type bool. It receives a letter in a parameter of type char. If the letter is either E, e , or F,f, the value false should be returned, otherwise the value true should be returned.
Question 1c:
Write a full fledged modular program that contains the functions letters and passOrNot that you wrote in Questions 1a and 1b. The program has to determine who pass and who do not pass, given a list of marks. It should also inform how many students passed and how many failed as well the number of distinctions. (>= 75%). The main( ) function should contain a while loop that is repeated until XXX is entered for a mark. Run the program on the list of marks below and submit printouts of the program and the output
22
55
80
48
60
87
44
50
77
17
XXX