本文整理汇总了C++中Person::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Person::clear方法的具体用法?C++ Person::clear怎么用?C++ Person::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/**********************************************************************
* Add text here to describe what the function "main" does. Also don't forget
* to fill this out with meaningful text or YOU WILL LOSE POINTS.
***********************************************************************/
int main(int argc, const char* argv[])
{
//change this back to 2 to be universal
if (argc < 1)
{
cout << "Usage: a.out fileName\n";
}
else
{
List<Person> people;
ifstream fin;
//string fileName = argv[1];
string fileName = "cameron.ged";
string tmp;
//Read in file
do
{
fin.clear();
fin.open(fileName.c_str());
}
while(fin.fail());
Person person;
//parse file into list
while(getline(fin, tmp))
{
if(tmp.substr(0,4) == "0 @I")
{
person.idNumber = tmp.substr(4,4);
fin.ignore();
}
if(tmp.substr(0,6) == "2 GIVN")
{
person.fname = tmp.substr(6);
}
if(tmp.substr(0,6) == "2 SURN")
{
person.lname = tmp.substr(6);
}
if(tmp.substr(0,6) == "1 BIRT")
{
getline(fin, tmp);
if(tmp.substr(0,6) == "2 DATE")
{
person.bday = tmp.substr(6);
}
}
if(tmp.substr(0,6) == "3 TIME")
{
people.push_back(person);
person.clear();
}
}
sortMerge(people);
for(ListIterator<Person> it = people.begin(); it != people.end(); it++)
{
(*it).display();
}
//cout << tmp << endl;
//organize by name
//Put into tree
//output
}
return 0;
}