本文整理汇总了C++中DynamicList::deletePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicList::deletePosition方法的具体用法?C++ DynamicList::deletePosition怎么用?C++ DynamicList::deletePosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynamicList
的用法示例。
在下文中一共展示了DynamicList::deletePosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteController
/*
functia incarca in lista elementele din fisier api cauta in lista cheltuiala dupa numar
daca aceasta cheltuiala este gasita atunci se efectuiaza stergerea, daca nu se afiseaza ca
elementul nu e in lista
*/
void ControllerClass::deleteController(int id) {
DynamicList lista;
RepositoryClass rep = RepositoryClass::RepositoryClass();
rep.loadFromFlie(lista);
int cautare = findById(id);
if (cautare != -1 ) {
lista.deletePosition(cautare);
rep.saveInFile(lista);
cout << "Stergerea s-a efectuat cu succes" << endl;
}
else
cout << "Cheltuiala respectiva nu se afla in lista" << endl;
}
示例2: loadFromFlie
/*
Iau elementele de tip cheltuiala din fisier si le pun in
lista
*/
void RepositoryClass::loadFromFlie(DynamicList & lista) {
int id;
int number;
float amount;
char type[10];
ifstream fin("expenses.txt");
char c2;
int i = 1;
do{
fin >> id >> number >> amount >> type;
c2 = fin.peek();
lista.append(DomainClass::DomainClass(id,number,amount,type));
}while(c2 == '\n');
//imi pune tot timpul un caracter in plus asa ca il fac gol si scad iter
lista.deletePosition(lista.getLength()-1);
fin.close();
}