
Untitled
By: a guest on
Aug 8th, 2012 | syntax:
None | size: 0.56 KB | hits: 7 | expires: Never
Remove element from a list in C
Account AccountList::remove(int i){
if(i>=0 && i<size()) {
for (int n = i; n < size(); n++) {
if(i+1!=size()) {
aList[n]=aList[n+1];
}
}
sz--;
return aList[i];
} else {
return Account();
}
}
Account AccountList::remove(int i)
{
if(i>=0 && i<size())
{
Account a = aList[i]
for (int n = i; n < size() - 1; n++)
{
if(i+1!=size())
{
aList[n]=aList[n+1];
}
}
sz--;
return a;
} else
{
return Account();
}
}