本文整理汇总了C++中LinkList::Invert方法的典型用法代码示例。如果您正苦于以下问题:C++ LinkList::Invert方法的具体用法?C++ LinkList::Invert怎么用?C++ LinkList::Invert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinkList
的用法示例。
在下文中一共展示了LinkList::Invert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
int a[] = {1,9,3,5,19,38,29,2,4,25,61,-1,7};
LinkList<int>* list = new LinkList<int>(a, 13);
list->PrintLinkList();
int listlength = list->ListLength();
std::cout<<"the list length is"<<listlength<<std::endl;
int theLastElement = list->Get(13);
assert(theLastElement == 7);
std::cout<<"the last element value is"<< theLastElement << std::endl;
std::cout<<"the values that the array contained currently display"<<std::endl;
list->PrintLinkList();
std::cout<<std::endl;
std::cout<<"delete the eigth element 2";
std::cout<<std::endl;
list->Delete(8);
std::cout<<"the values that the array contained currently display"<<std::endl;
std::cout<<"the position of 61 is";
std::cout<<std::endl;
int position = list->Locate(61);
std::cout<<std::endl;
std::cout<<position<<std::endl;
std::cout<<"the values that the array contained currently display"<<std::endl;
list->PrintLinkList();
std::cout<<std::endl;
std::cout<<"now we add a value at first position"<<std::endl;
list->Insert(1, 11111);
std::cout<<"the values that the array contained currently display"<<std::endl;
list->PrintLinkList();
std::cout<<std::endl;
list->Invert();
std::cout<<"the invert array list is"<<std::endl;
list->PrintLinkList();
}