Question: C++, QUESTION REQUIRES VECTOR AND VOID NOT ONLY VOID. VECTOR AND VOID. Define gender as an enum Define a structure datatype (Student) with the members:
C++, QUESTION REQUIRES VECTOR AND VOID NOT ONLY VOID.
VECTOR AND VOID.
- Define gender as an enum
- Define a structure datatype (Student) with the members: fname, lname and id are strings, and gender is enum.
Create a function (readStudents) to read the students information from the provided input file; read the number of students, create vector of students to hold all information and fill it with the data read from the file. vector readStudents(string file_name);
- Write a function (printStudent) that prints the student information.
void printStudent(const Student& st);
- Write a function (getFemales) that return a vector of Students containing only female students.
vector getFemales(const vector& stds);
- Write a function (getLowAttenance) that return a vector of Students whose attendance is less than 20.
vector getLowAttendance(const vector& stds);
- Write a main ( ) program that does the following:
-
- Read the file content into a vector of Students, stds_vect.
- Print all students information on the console.
- Get the Female students and print their information on the console.
- Get the students with low attendance and print their information on the console.
Get the students with low attendance and print their information on the console. Content of students.txt 8 ID Gender (enum 0:m, Lif) 1 0 2 1 5 0 4 1 19 1 21 0 88 1 1930 0 First Name LName Course Attendance Mohammad Saleh CMP220 30 Sara Ali CMP220 28 Charles Dickens CMP220 25 Jain Austin CMP220 23 Ablam Mosteghanemi_CMP220 15 Mario Puza CMP220 21 Marie Curie CMP220 30 John Steinbeck CMP220 19 A sample output is given below: X
Name (Austin] Gender [Female] Course [CMP220] Attendance [23] ID [19] First Name [Ahlam] Last Name [Mosteghanemi] Gender [Female] Course [CMP220] Attendance [15] ID [88] First Name [Marie] Last Name [Curie) Gender [Female] Course [CMP220] Attendance [30] The Students with low Attendace are : ID [19] First Name [Ahlam] Last Name [Mosteghanemi] Gender [Female] Course [CMP220] Attendance [15] ID [1930] First Name [John] Last Name (Steinbeck] Gender [Male] Course (CMP220] Attendance [19] Press any key to continue . . Question 2: Repeat Question 1 but change the Enum gender to be an Enum class instead of a normal Enum.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
