当前位置: 首页>>代码示例>>C++>>正文


C++ DynamicList::getLength方法代码示例

本文整理汇总了C++中DynamicList::getLength方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicList::getLength方法的具体用法?C++ DynamicList::getLength怎么用?C++ DynamicList::getLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicList的用法示例。


在下文中一共展示了DynamicList::getLength方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sortAmountController

void ControllerClass::sortAmountController(DynamicList & lista){
	DomainClass aux,aux1;
	RepositoryClass rep = RepositoryClass::RepositoryClass();
	rep.loadFromFlie(lista);
	for (int i = 0;i < lista.getLength()-1; ++i)
		for(int j = i+1; j < lista.getLength(); ++j)
			if (lista[i].getAmount() > lista[j].getAmount())
			{
				aux = lista[i];
				aux1 = lista[j];
				lista.updatePosition(i,aux1);
				lista.updatePosition(j,aux);	
			}
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:14,代码来源:ControllerClass.cpp

示例2: sortTypeControllerDesc

void ControllerClass::sortTypeControllerDesc(DynamicList & lista){
	DomainClass aux,aux1;
	
	RepositoryClass rep = RepositoryClass::RepositoryClass();
	rep.loadFromFlie(lista);
	for (int i = 0;i <= lista.getLength()-1; ++i)
		for(int j = i;j < lista.getLength(); ++j)
			if (strcmp(lista[i].getType(),lista[j].getType()) < 0)
			{
				aux = lista[i];
				aux1 = lista[j];
				lista.updatePosition(i,aux1);
				lista.updatePosition(j,aux);
			}
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:15,代码来源:ControllerClass.cpp

示例3: findByType

int ControllerClass::findByType(char* tip) {
	DynamicList lista;
	RepositoryClass rep = RepositoryClass::RepositoryClass();
	rep.loadFromFlie(lista);
	for (int pozitia = 0;pozitia < lista.getLength()  ;++pozitia)
		if(strcmp(lista[pozitia].getType(),tip) == 0)
			return pozitia;
	return -1;
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:9,代码来源:ControllerClass.cpp

示例4: findById

/*
	Functia cauta o cheltuiala dupa numar,daca ea apare ii va return pozitia 
	cheltielii in lista si in caz contrar va returna 0
*/
int ControllerClass::findById(int id) {	
	DynamicList lista;
	RepositoryClass rep = RepositoryClass::RepositoryClass();
	rep.loadFromFlie(lista);

	for (int pozitia = 0;pozitia < lista.getLength(); ++pozitia)
		if(lista[pozitia].getId() == id)
			return pozitia;
	return -1;
	lista.~DynamicList();
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:15,代码来源:ControllerClass.cpp

示例5: filterTypeController

void ControllerClass::filterTypeController(char* tip) {
	DomainClass* filtrate = new DomainClass[100];
	int contor = 0;
	DynamicList lista;
	RepositoryClass rep = RepositoryClass::RepositoryClass();
	rep.loadFromFlie(lista);

	for( int i = 0; i < lista.getLength(); ++i)
		if (strcmp(lista[i].getType(),tip) == 0) {
			contor ++;
			filtrate [contor]  = lista[i];
		}
	for( int i = 1; i <= contor; ++i)
		filtrate[i].print();
	cout << endl;
	delete[] filtrate;
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:17,代码来源:ControllerClass.cpp

示例6: 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();
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:22,代码来源:RepositoryClass.cpp

示例7: filterAmountController

/*
	Functie de tipul DomainClass care va returna o lista care contine cheltuielile cu suma mai mare de
	cat suma primita ca parametru

	*/
void ControllerClass::filterAmountController(float suma) {
	DomainClass* filtrate = new DomainClass[100];
	int contor = 0;
	DynamicList lista;
	RepositoryClass rep = RepositoryClass::RepositoryClass();
	rep.loadFromFlie(lista);

	for( int i = 0; i < lista.getLength(); ++i)
		if (lista[i].getAmount() >= suma) {
			contor ++;
			filtrate [contor]  = lista[i];
		}
	for( int i = 1; i <= contor; ++i)
		filtrate[i].print();
		
	delete[] filtrate;
	//lista.~DynamicList();
	cout << endl;		
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:24,代码来源:ControllerClass.cpp

示例8: saveInFile

void RepositoryClass::saveInFile(DynamicList & lista) {
	ofstream fout("expenses.txt");
	for (int i = 0;i < lista.getLength()  ;++i)
		fout<<lista[i].getId()<<" "<<lista[i].getNumber()<<" "<<lista[i].getAmount()<<" "<< lista[i].getType()<<'\n';
	fout.close();
}
开发者ID:BoldijarPaul,项目名称:babes-info-romana,代码行数:6,代码来源:RepositoryClass.cpp


注:本文中的DynamicList::getLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。