本文整理汇总了C++中LList::Delete方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::Delete方法的具体用法?C++ LList::Delete怎么用?C++ LList::Delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LList
的用法示例。
在下文中一共展示了LList::Delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main() {
//new list
LList myList;
int listCount;
myList.Append(456);
myList.Append(22);
myList.Append(4);
myList.Append(1095);
myList.Append(1888);
//myList.AppendMiddle(499, -1); //test for entering negative position
//myList.AppendMiddle(423, 4);
myList.Print();
cout << "Number of items in list: " << myList.ListLength() << endl << endl;
cout << "Deleting a node... " << endl;
myList.Delete(456);
cout << "\n\n";
myList.Delete(10); //test for deleting a non-existent node
cout << "Number of items in list: " << myList.ListLength();
cout << "\n\n";
myList.Print();
cout << "\nTail: " << myList.Tail()->Data();
//reverse the list
myList.reverse();
cout << "\n\nList reversed: ";
myList.Print();
cout << "Head: " << myList.Head()->Data(); //returns the head of the list
getchar(); //pause console exit to examine output
}