Question: Use C++ please and read carefully. Update this code and change the Enum gender to be an Enum class instead of a normal Enum. Please

Use C++ please and read carefully. Update this code and change the Enum gender to be an Enum class instead of a normal Enum. Please answer ASAP

Code given:

#include #include #include using namespace std; enum Gender { male, female }; struct Student { string firstName, lastName; int id; Gender gen; int attendance; string course; }; void printStudent(Student std); void printLow(Student* std, int count); void printFemale(Student* std, int count); int main() { int num_student; Student* std; Student temp; string line; int gen; ifstream infile("students.txt"); infile >> num_student; std = new Student[num_student]; getline(infile, line); getline(infile, line); int i = 0; while (!infile.eof()) { infile >> temp.id >> gen >> temp.firstName >> temp.lastName >> temp.course >> temp.attendance; temp.gen = (Gender)gen; std[i] = temp; i++; } cout printFemale(std, num_student); cout printLow(std, num_student); system("pause"); return 1; } void printLow(Student* std, int count) { cout.width(8); cout cout.width(15); cout cout.width(15); cout cout.width(15); cout cout.width(15); cout cout for (int i = 0; i { if (std[i].attendance printStudent(std[i]); } } void printFemale(Student* std, int count) { cout.width(8); cout cout.width(15); cout cout.width(15); cout cout.width(15); cout cout.width(15); cout cout for (int i = 0; i { if (std[i].gen == female) printStudent(std[i]); } } void printStudent(Student std) { string gen; cout.width(8); cout if (std.gen == 0) gen = "Male"; else gen = "Female"; cout.width(15); cout cout.width(15); cout cout.width(15); cout cout.width(15); cout cout }

students.txt

8 1 0 Mohammad Saleh CMP220 30 2 1 Sara Ali CMP220 28 5 0 Charles Dickens CMP220 25 4 1 Jain Austin CMP220 23 19 1 Ahlam Mosteghanemi CMP220 15 21 0 Mario Puzo CMP220 21 88 1 Marie Curie CMP220 30 1930 0 John Steinbeck CMP220 19

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!