本文整理匯總了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;
}