Do not use windows specific lib/headers Suppose we have a class class Person { p
ID: 3658528 • Letter: D
Question
Do not use windows specific lib/headers
Suppose we have a class
class Person {
public:
int id;
vector<float> scores;
float averageScore;
};
And we also have a vector of type person.
Vector<Person>v;
In this vector we are going to store details of persons, the details will be read from a file.
The file contains a space separated list of numbers. Each person takes 4 subjects so there will be a total of 4*n numbers in the file. Read all the numbers from the file and maintain a count of the numbers read. (your main FUNCTION should accept the name of the files as input).
Divide the count by 4. That will give you the number of students whose data is being read in.
Set up the vector
Explanation / Answer
#include #include #include #include using namespace std; class Person { public: int id; vector scores; float averageScore; }; void createtestfile(){//for testing purpose string datA="100 100 100 90 90 90 90 0 100 100 100 100 50 50 50 50"; ofstream make("testA.dat"); makeRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.