-
用數(shù)組實(shí)現(xiàn)棧查看全部
-
.h文件內(nèi)容查看全部
-
棧的成員函數(shù)查看全部
-
可以用類模版將查看全部
-
將普通棧改造為類模板棧,使其使用于任何數(shù)據(jù)類型查看全部
-
做類模板時(shí)注意要講stack.cpp文件和stack.h文件寫(xiě)到一起查看全部
-
十進(jìn)制轉(zhuǎn)為任意進(jìn)制的方法查看全部
-
十進(jìn)制轉(zhuǎn)為任意進(jìn)制的方法查看全部
-
要讓該行代碼(不是char型 而是新定義的類)生效,棧的構(gòu)造函數(shù)必須是默認(rèn)構(gòu)造函數(shù)查看全部
-
1.注意 當(dāng)函數(shù)形參是引用時(shí),實(shí)參必須是變量或者變量的引用,而不能是具體的值 例如:如果要傳 3,必須先int a=3,再把a(bǔ)傳進(jìn)去 2.新建文件到項(xiàng)目里時(shí)要勾選那兩個(gè)選項(xiàng)查看全部
-
可加一個(gè)bool型的參數(shù)來(lái)選擇按什么方式遍歷查看全部
-
實(shí)現(xiàn)出棧函數(shù)時(shí) 有兩種方式 1.char的返回類型(當(dāng)為空時(shí)拋出異常) 2.bool的返回類型查看全部
-
寫(xiě)成0==m_iTop代碼質(zhì)量更高,因?yàn)槿绻粚?xiě)了一個(gè)等號(hào),會(huì)報(bào)語(yǔ)法錯(cuò)誤,從而能夠快速糾錯(cuò)查看全部
-
老師的看起來(lái)好不得勁啊 #include<iostream> #include<stack> #include<cstdlib> using namespace std; int eight(int m) { int n=0; stack<int>s; do { n=m%8; m=m/8; s.push(n); }while(m!=0); while(s.size()!=0) { cout<<s.top(); s.pop(); } cout<<endl; } int sixteen(int m) { int p=0; stack<int>s; do { p=m%16; m=m/16; s.push(p); }while(m!=0); while(s.size()!=0) { cout<<s.top(); s.pop(); } cout<<endl; } int two(int m) { int i=0; stack<int>s; do { i=m%2; m=m/2; s.push(i); }while(m!=0); while(s.size()!=0) { cout<<s.top(); s.pop(); } cout<<endl; } int main() { int m; cin>>m; eight(m); sixteen(m); two(m); system("pause"); return 0; }查看全部
-
棧,后入先出查看全部
舉報(bào)
0/150
提交
取消