I'd like to know how I can assign the value of a vector<string> to another vector.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int j = 0;
for (int i = 0; i < vs.size() / 4; i++)
vc[i].fullName = vs[j];
vc[i].idcardNo = vs[j + 1];
string s = vs[j + 2];
vc[i].accountNumber = (float)atof(s.c_str());
string d = vs[j + 3];
vc[i].balance = (float)atof(d.c_str());
j = j + 4;
I am getting the error that a vector is out of range on the bold line. I checked via debugging that vs[j] has a value of "John Doe", so the error must be from the vc[i].fullName .... can anyone point me towards a solution please?