[go: up one dir, main page]

0% found this document useful (0 votes)
135 views1 page

Friend Function Exercise

The document describes a C++ program that uses a Student class and two friend functions, Grader() and Display(), to calculate statistics for students' marks across 5 courses. The program first asks the user to enter the number of students, then prompts for each student's name, surname, and individual marks in Visual Basic, C++, web design, mathematics, and physics. Grader() calculates the sum, mean, and percentage of marks for each student using the Student class's GetMarks() member function to retrieve the marks from the user. Display() then outputs each student's name, surname, mean, and percentage.

Uploaded by

kubana friend
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views1 page

Friend Function Exercise

The document describes a C++ program that uses a Student class and two friend functions, Grader() and Display(), to calculate statistics for students' marks across 5 courses. The program first asks the user to enter the number of students, then prompts for each student's name, surname, and individual marks in Visual Basic, C++, web design, mathematics, and physics. Grader() calculates the sum, mean, and percentage of marks for each student using the Student class's GetMarks() member function to retrieve the marks from the user. Display() then outputs each student's name, surname, mean, and percentage.

Uploaded by

kubana friend
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

FRIEND FUNCTION EXERCISE

Q1. By using a class called student, write a C++ program that uses a friend function
Grader() to calculate the sum, the mean and the percentage of the marks of students in
5 courses namely Visual Basic (vb), C++ programming (cpp), web design (wd),
mathematics (math) and physics (phy). The User shall be asked the number of students
s/he will record then the program asks him/her to enter the name, surname of the
students, and the marks obtained by each student in 5 courses, the program will
calculate the sum, mean and the percentage, then using a friend function Display ()
displays on the screen the name, surname, mean and percentage of each student.

N.B: The students Marks must be kept in the instance variables of the class
student and use a member Function GetMarks() to receive the marks from
the user.

You might also like