(Solved) : Write Using C Comments Function Code Used Using Previous Class Needed Source File Includ Q37266568 . . .


write using c++ with comments each function what it does .
This is the code that was used using the previous class if it isneeded .
Source FILE:
#include<iostream>
#include<string>
#include”Student.h”
#include <fstream>
int main()
{
Student st[5];
ofstream file;
file.open(“Data.txt”);//file
int id;
string name;
float cgpa;
//get inputs
for (int i = 0; i<5;i++)
{
cout << “Enter the details of student ” << i + 1;
cout << “nEnter ID: “;
cin >> id;
cin.ignore();
cout << “Enter Name: “;
getline(cin, name);
cout << “Enter Cgpa: “;
cin >> cgpa;
cout << “n”;
st[i].setValues(id, name, cgpa);
}
//write to file
for (int i = 0; i<5;i++)
file << st[i].getID() << “,” << st[i].getName()<< “,” << st[i].getCgpa() << “n”;
file.close(); //closefile
cout << “nWritten tofile Data.txt” << endl;
return 0;
}
Header File:-
#include <iostream>
#include <fstream>
using namespace std;
//student
class Student
{
//member variable
private:
int id;
string name;
float cgpa;
//functions
public:
void setValues(int i,string n, float c)
{
this->id = i;
this->name = n;
this->cgpa = c;
}
//return id
int getID() {
return id;
}
//return name
string getName() {
return name;
}
//return cgpa
float getCgpa() {
return cgpa;
}
};
Develop a C++ application to read information from the given text file “Data.txt” and show the output in screen. Use the previous class “Student” for this. In main, create an array of five Student pointers and fill the array with new Student objects which is read from data. Once the array is full, loop through it and read the information back and show them onto screen. Data.txt 101,Muhamed Sami,2.8 102,Abdul Rashid,2.9 103,Samira Husein,3.5 104,Shani Hoffman,3.8 105,Levi Simon,4.0 Screen shot 101, Muhamed Sami,2.8 102,Abdul Rashid,2.9 103, Samira Husein,3.5 104, Shani Hoffman, 3.8 105, Levi Simon,4 Press any key to continue Show transcribed image text Develop a C++ application to read information from the given text file “Data.txt” and show the output in screen. Use the previous class “Student” for this. In main, create an array of five Student pointers and fill the array with new Student objects which is read from data. Once the array is full, loop through it and read the information back and show them onto screen. Data.txt 101,Muhamed Sami,2.8 102,Abdul Rashid,2.9 103,Samira Husein,3.5 104,Shani Hoffman,3.8 105,Levi Simon,4.0
Screen shot 101, Muhamed Sami,2.8 102,Abdul Rashid,2.9 103, Samira Husein,3.5 104, Shani Hoffman, 3.8 105, Levi Simon,4 Press any key to continue
Expert Answer
Answer to write using c++ with comments each function what it does . This is the code that was used using the previous class if it…
OR