Yes you can use a vector for this, simply declare 3 vectors, one for names, one for size, and one for vote. This is probably the simplest way to do it.
as for reading and writing to the file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include<fstream>
#include<string>
usingnamespace std;
int main() {
string name("John"); //assuming it is string
int size = 5; //assuming it is int
bool vote; //assuming it is bool
ofstream oFile("file.txt");
file << name << ' ' << size << ' ' << vote << endl; //writing to file
oFile.close();
ifstream iFile("file.txt");
file >> name >> size >> vote; //reading from file
iFile.close();
return 0;
}
Well, I don't know how well this code works, cause I haven't coded quite a long time...but I think it gives the general idea.