Question 2 - Using functions, design and write a program to calculate students' grades for n students (where n is entered by the user). The program starts by getting the number of students, and all the students names, midterm and final grades. It then computes for each student their average (both exams carry equal weight), and their letter grades ('F'=0..49, 'C'-50..64, 'B'=65..79,'A'= 80..100. At the end, the program prints all the information in a tabular format). Here is a skeleton of your program: const int MAX = 10; // Global constant for the array size // Function to get the information from the user void get_info (int &n, string names [], double mid[], double final []); // Function to calculate the students total mark void calc_averages (int n, double mid[], double final[], double ave[]); // Function to calculate the students letter grades void calc_grades (int n, ave[1, char grades []); // Function to print everything void print_all (int n,string names [], double mid [], double final [], double ave[1, char grades []); int main() { } string names [MAX]; double mid [MAX]; double fin [MAX]; double ave [MAX]; char grades [MAX]; get-info (n, names, mid, final); calc_averages (n, mid, final, ave); calc_grades (n, ave, grades); print_all (n, names, mid, final, ave, grades); A

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question
Question 2
Using functions, design and write a program to calculate students' grades for n students (where n is
entered by the user). The program starts by getting the number of students, and all the students
names, midterm and final grades. It then computes for each student their average (both exams carry
equal weight), and their letter grades ('F'=0..49, 'C'-50..64, 'B'=65..79,'A'= 80..100. At the end, the
program prints all the information in a tabular format).
Here is a skeleton of your program:
const int MAX = 10; // Global constant for the array size
// Function to get the information from the user
void get_info (int &n, string names [], double mid [], double final []);
// Function to calculate the students total mark
void calc_averages (int n, double mid [], double final [], double ave[]);
// Function to calculate the students letter grades
void calc_grades (int n, ave[], char grades[]);
// Function to print everything
void print_all (int n, string names [], double mid[],double final[], double ave[], char grades []);
int main() {
}
string names [MAX];
double mid [MAX];
double fin [MAX];
double ave [MAX];
char grades [MAX];
get-info (n, names, mid, final);
calc averages (n, mid, final, ave);
calc_grades (n, ave, grades);
print_all (n, names, mid, final, ave, grades);
Transcribed Image Text:Question 2 Using functions, design and write a program to calculate students' grades for n students (where n is entered by the user). The program starts by getting the number of students, and all the students names, midterm and final grades. It then computes for each student their average (both exams carry equal weight), and their letter grades ('F'=0..49, 'C'-50..64, 'B'=65..79,'A'= 80..100. At the end, the program prints all the information in a tabular format). Here is a skeleton of your program: const int MAX = 10; // Global constant for the array size // Function to get the information from the user void get_info (int &n, string names [], double mid [], double final []); // Function to calculate the students total mark void calc_averages (int n, double mid [], double final [], double ave[]); // Function to calculate the students letter grades void calc_grades (int n, ave[], char grades[]); // Function to print everything void print_all (int n, string names [], double mid[],double final[], double ave[], char grades []); int main() { } string names [MAX]; double mid [MAX]; double fin [MAX]; double ave [MAX]; char grades [MAX]; get-info (n, names, mid, final); calc averages (n, mid, final, ave); calc_grades (n, ave, grades); print_all (n, names, mid, final, ave, grades);
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr