本文整理汇总了C++中People::addIndi方法的典型用法代码示例。如果您正苦于以下问题:C++ People::addIndi方法的具体用法?C++ People::addIndi怎么用?C++ People::addIndi使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类People
的用法示例。
在下文中一共展示了People::addIndi方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeFromFile
void Dataread::removeFromFile(const People& p1,const Individual& i1)
{
//bool atBegin = true;
People removed;
for (int i = 0; i < p1.getSize(); i++)
{
if(!(p1.getIndi(i) == i1))
{
removed.addIndi(p1.getIndi(i));
}
}
ofstream file;
file.open(filename.c_str());
for (int i = 0; i < removed.getSize()-1; i++)
{
//cout << atBegin << endl;
file << removed.getIndi(i).getSurname() << endl;
file << removed.getIndi(i).getName() << endl;
file << removed.getIndi(i).getGender() << endl;
file << removed.getIndi(i).getBirth() << endl;
file << removed.getIndi(i).getDeath()<<endl;
}
file << removed.getIndi(removed.getSize()-1).getSurname() << endl;
file << removed.getIndi(removed.getSize()-1).getName() << endl;
file << removed.getIndi(removed.getSize()-1).getGender() << endl;
file << removed.getIndi(removed.getSize()-1).getBirth() << endl;
file << removed.getIndi(removed.getSize()-1).getDeath();
file.close();
}