本文整理汇总了C++中TList::inverseList方法的典型用法代码示例。如果您正苦于以下问题:C++ TList::inverseList方法的具体用法?C++ TList::inverseList怎么用?C++ TList::inverseList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TList
的用法示例。
在下文中一共展示了TList::inverseList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// cout << "List has last " << k << "th node: " << result->data << endl;
//}
// 3 合并俩个有序的单链表===========================
//int data[]={1,5,7,8,11,16};
//int dataLen = sizeof(data)/sizeof(*data);
//List myList;
//CList aList = NULL;
////初始化List
//myList.initList(&aList);
////往链表中插入值
//for(int i=0; i<dataLen; i++){
// myList.insertNodeLast(aList,data[i]);
//}
////输出链表
//std::cout << " List a:" << endl;
//myList.traverseList(aList);
//// list b
//int dataB[]={2,4,7,8,21,36};
//int dataBLen = sizeof(data)/sizeof(*dataB);
//CList bList = NULL;
////初始化List
//myList.initList(&bList);
////往链表中插入值
//for(int i = 0; i < dataBLen; i++){
// myList.insertNodeLast(bList, dataB[i]);
//}
////输出链表
//std::cout << " List b:" << endl;
//myList.traverseList(bList);
//TList tList;
//CList mList = tList.mergeList(aList, bList);
//if(mList == NULL){
// cout << "ERROR: input para error. " << endl;
//}
//else{
// cout << "List a and List b are merge into List: " << endl;
// myList.traverseList(mList);
//}
// 4 inverse list===================================
int data[]={1,5,3,2,4,6};
int dataLen = sizeof(data)/sizeof(*data);
List myList;
CList cList = NULL;
//初始化List
myList.initList(&cList);
//往链表中插入值
for(int i=0; i<dataLen; i++){
myList.insertNodeLast(cList,data[i]);
}
//输出链表
std::cout << " traverse List:" << endl;
myList.traverseList(cList);
TList tList;
tList.inverseList(cList->next);
cout << endl;
// ==================================================
//栈的一个实际应用 ---- 表达式计算
/*string expression ="1+2*3";
string sub = expression.substr(2,1);
std::cout<<sub;*/
/*stack<int> stExample;
stExample.push(1);
stExample.push(2);
cout<<"top: "<<stExample.top()<<endl;
vector<int> vTest;
vTest.push_back(1);
vTest.push_back(2);
vTest.push_back(3);
cout<<"vector: "<<vTest[1]<<endl;*/
//Arithmetic myArithmetic;
//myArithmetic.runCalculateOperation();
int iCin;
cout<<"input any character to exit." << endl;
scanf("%d", &iCin);
return 0;
}