本文整理汇总了C++中Person::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Person::add方法的具体用法?C++ Person::add怎么用?C++ Person::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Person* pm = new Person("Peyton","Manning",37,3);
Person* al = new Person("Andrew","Luck",24,4);
Person* ck = new Person("Colin","Kaepernick",26,4);
Person* db = new Person("Drew","Brees",35,4);
Person* tb = new Person("Tom","Brady",36,4);
pm->add(al);
al->add(pm);
al->add(db);
al->add(tb);
al->add(ck);
cout<<pm->toFullString()<<endl<<endl;
int list1Size,list2Size;
Person** list1=pm->getFriendList(list1Size);
cout<<list1[0]->toFullString()<<endl<<endl;
for(int i=0; i<list1Size; i++)
{
Person** list2=list1[i]->getUncappedFriends(list2Size);
for(int j=0; j<list2Size; j++)
{
pm->add(list2[j]);
}
delete[] list2;
}
cout<<pm->toFullString()<<endl<<endl;
Person* empty = 0;
try
{
empty=new Person("","",-4,5);
}
catch(exception &e)
{
cout<<e.what()<<endl;
}
delete[] list1;
delete pm;
delete al;
delete ck;
delete db;
delete tb;
if(empty != 0)
delete empty;
return 0;
}