the goal in the driver program is to Change the data structure that stores the membershipTypes from an array to a vector.
and to also declare an iterator i to index this array.
what i did so far i think is correct but when i try to cout the information i get no operator << matches this operand how do i fix my code?
#include <iostream>
#include <fstream>
#include "personType.h"
#include <string>
#include <vector>
using namespace std;
int main()
{
vector <membershipType> members; // vector of membershipTypes
vector <membershipType>::iterator i; // iterator for the members vector
string x, i1, i2;
ifstream myfile;
myfile.open("infile.txt");
for (int i = 0; i < 6; i++)
{
myfile >> members[i].lastName >> members[i].firstName >> members[i].personNum >>
members[i].personID >> members[i].address.streetAddressNum >>
members[i].address.streetName >> members[i].address.streetType >> members[i].address.city >> members[i].address.stateInitials >> members[i].address.zipCode >> members[i].gender;
myfile >> i1 >> i2;
myfile >> members[i].membership_status;
myfile >> members[i].membership_type;
members[i].setInterest1(i1);
members[i].setInterest2(i2);
members[i].print_membership_type();
}
myfile.close();
system("pause");
return 0;
for (vector<membershipType>::iterator i = members.begin(); i != members.end(); ++i)
{ cout << *i << endl; }
}
Aucun commentaire:
Enregistrer un commentaire