当前位置: 首页 > news >正文

自己做免费网站的流程工作室注册流程

自己做免费网站的流程,工作室注册流程,wordpress开发语言,网站建设5000费用预算原理#xff1a; 数据栈#xff1a;有数据就直接入栈 运算符栈#xff1a;设遍历到当前的运算符位e#xff0c;如果栈不为空#xff0c;比较栈顶与当前运算符优先级e#xff0c;当栈顶运算符优先级大于或者等于e的优先级#xff0c;则出栈#xff0c;并将两个数据栈的… 原理 数据栈有数据就直接入栈 运算符栈设遍历到当前的运算符位e如果栈不为空比较栈顶与当前运算符优先级e当栈顶运算符优先级大于或者等于e的优先级则出栈并将两个数据栈的数据出栈计算出对应的数据加入到数据栈中否则将运算符入栈 #include iostream #include unordered_map #include stack #include functional #include string#define MAX_PRI INT_MAXusing namespace std; int main() {//数据栈stackdouble _data; //运算符栈stackchar _operator; //运算符优先级unordered_mapchar, int pri{ {, 0}, {-, 0}, {*, 1}, {/, 1}, {^, 2}, {(, MAX_PRI }, {), MAX_PRI}};unordered_mapchar, functiondouble(double, double) func{{, [](double x, double y) - double { return x y; }},{-, [](double x, double y) - double { return x - y; }}, {*, [](double x, double y) - double { return x * y; }},{/, [](double x, double y) - double { return x / y; }},{^, [](double x, double y) - double { return pow(x, y); }}};string exp;cin exp;auto calculate [_data, _operator, func]() {char op _operator.top();_operator.pop();double x _data.top();_data.pop();double y _data.top();_data.pop();_data.push(func[op](y, x)); //运算顺序与出栈顺序相反};auto stringtonum [exp, pri](int i) - double {int j i 1;while (j exp.length() pri.find(exp[j]) pri.end()) j;double num stod(exp.substr(i, j - i));i j - 1; return num;};for (int i 0; i exp.length(); i) {char e exp[i];if (pri.find(e) pri.end()) { //当前字符不是运算符则切割数字_data.push(stringtonum(i));} else if (e () {_operator.push(();} else if (e )) {while (_operator.top() ! () {calculate();}_operator.pop();} else {//当前运算符优先级栈顶运算符优先级则出栈计算while (!_operator.empty() pri[_operator.top()] pri[e] _operator.top() ! () {calculate();}_operator.push(e);}}while (!_operator.empty()) {calculate();}cout _data.top() endl; }
http://www.dnsts.com.cn/news/106653.html

相关文章:

  • 怎么做集团网站自己建网站步骤
  • 电脑搭建网站网站上有声的文章是怎么做的
  • asp网站代码 部分封装中山网站建设文化价格
  • 物流网站的建设论文网站制作英文版网站
  • 哪个网站能在线做司考题目资讯网站排版
  • 网站如何做reference视频点播网站开发
  • 电商网站开发脑图网络广告策划公司
  • 宁波外贸seo网站建设集约化网站群建设方案
  • 做图剪片文案网站app接单中信建设有限责任公司钱三强
  • 沈阳seo自然优化排名宁波seo站外优化推广
  • 做ppt模板下载网站为止笔记发布到wordpress
  • php网站开发工程企业邮箱有什么作用
  • 刷赞网站推广空间免费辽宁城乡建设集团网站
  • 在外国租服务器做那种网站北京哪个网站建设最好
  • 天津非常好的网站建设wordpress 查看文章id
  • 网站导航页面模板个人网页制作模板html
  • 做衣服的教程网站有哪些文档生成器app
  • 青岛做公司网站注册的多吗wordpress 怎么安装插件
  • 邢台本地网站自己的网站首页背景怎么做
  • 深圳网站建设公司招聘电话销售大连公司企业网站建设
  • 做seo是要先有网站吗大连网站建设流程图
  • 创业网站推广怎么做发果怎么做视频网站
  • 平东网站建设有云服务器和域名怎么做网站
  • 酒生产企业网站建设的目的高清免费素材网站
  • 做零食用哪个网站好wifi已连接(无法上网)
  • 点击网络怎么做网站wordpress 版微信小程序
  • 网站客户端制作教程网站栏目设置完整度建设
  • 上城区网站建设价格设计制作小车二教学视频
  • 乐山市住房和城乡建设局网站代理怎么做
  • 技术支持 创思佳网站建设成都网站优化外包