hello everyone....i need some help,i am using c++ and vectors, and text files to create a library system and i have a problem.....i used a vector named v1 and i was trying to use an if else to assign a created vectors elements value to another value
example like v[10] is "Storybook5"
i tried this v[10]="storybook3"
and this also v.at(10)="storybook3"
it still will not change,it ll come out Storybook5
i need help.....this is my code.....
void LibraryMember::PrintLoanMem()//this is to print the members on loan,and reduce repetition of members
{
v1.clear();
ifstream loanfile("loan.txt");
string info;
int i;
int j;
int count=0;
int count2=0;
if (loanfile.is_open())
{
while(!loanfile.eof())
{
getline(loanfile,info);
v1.push_back(info);
count++;
}
}
count2=count;
v1[3]="";
for(i=0;i<count;i++)
{
for(j=0;j<count2;j++)
{
if (v1[j]==v1[i])
{
v1[j]=="";
}
}
}
ofstream out("loanMem.txt",ios::app);
size_t size = v1.size();
for (size_t i = 0; i < size; i++)
{
if(v1.at(i)=="")
{
}
else
out << v1[i] <<endl;
}
}//end function printloan mem