StackReverse 秃头王 有趣的知识 发布于:2022年1月6日 次浏览 Stack - 翻转1234567891011121314151617181920212223242526272829303132333435363738394041424344/************************************************************************* > File Name: stackRecerse.cpp > Author: 秃头王 > Mail: 1658339000@qq.com > Created Time: 2022年01月06日 星期四 10时15分16秒 ************************************************************************/#include <iostream>#include <stack>using namespace std;void reverseStack(stack<string> &f, string &res) { // 当然这里 string res 也可以写成另一个 栈 这里这个引用会加点速 if(!f.empty()) { string t = f.top(); f.pop(); reverseStack(f, res); res += t + " "; } return ;}int main() { stack<string> f, f1; f.push("a"); f.push("b"); f.push("c"); f.push("d"); f.push("e"); f.push("f"); f1 = f; while(!f1.empty()) { cout << f1.top() << " "; f1.pop(); } cout << endl; string res; reverseStack(f, res); cout << res; return 0;} 更新于:2022年1月19日 顺序表 数据结构 = 结构定义 + 结构操作cppreference https://zh.cppreference.com/w/%E9%A6%96%E9%A1%B5 顺序表 - 线性结构:... 将b进制数转化成十进制 秦九韶算法-将b进制数转化成十进制有二进制1010 取出 第一位 1 1 * 2 + 0 = 2 10 * 2 + 1 == 2 * 2 + 1 10 ...