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

网络营销方案包括哪些主要内容seo诊断方案

网络营销方案包括哪些主要内容,seo诊断方案,装修案例文案,网址导航怎么设置主页描述 对于一个不存在括号的表达式进行计算 输入描述: 存在多组数据,每组数据一行,表达式不存在空格 输出描述: 输出结果 示例1 输入: 6/233*4输出: 18思路: ①设立运算符和运算数两个…

描述

对于一个不存在括号的表达式进行计算

输入描述:

存在多组数据,每组数据一行,表达式不存在空格

输出描述:

输出结果

示例1

输入:

6/2+3+3*4

输出:

18

思路:

①设立运算符和运算数两个栈,,一个用来存储运算符,另一个用来存储运算数。

②在运算符栈中放置一个特殊运算符#,其优先级最低。

③将表达式尾部添加一个特殊运算符$,其优先级次低。

④从左至右依次遍历字符串,若遍历到运算符,则将其与运算符栈的栈顶元素进行比较,若运算符栈的栈顶的优先级小于该运算符,则将该运算符压入运算符栈;若运算符栈的栈顶的优先级大于该运算符,则弹出该栈顶运算符,从运算数栈中依次弹出运算数,完成弹出运算符对应的运算后,再将该结果压入运算数栈。

⑤若遍历到表达式中的运算数,则直接压入运算数栈。

⑥若运算符栈中仅剩两个特殊运算符#和$,则表达式运算结束,此时运算数栈中唯一的数字就是表达式的值。
 

源代码:

#include<iostream>
#include<stack>
#include<map>
#include<string>
using namespace std;//习题5.2 KY102 计算表达式
//考虑到需要计算的数字可能不止一位,就从检测到数字的索引开始,一直到检测不到数字的索引,这之间的就是一整个数字
double getNum(string str, int& index) {double res = 0;while (isdigit(str[index])) {res = res * 10 + str[index] - '0';index++;}return res;
}double cal(double x, double y, char op) {double res = 0;if (op == '+') {res = x + y;}else if (op == '-') {res = x - y;}else if (op == '*') {res = x * y;}else if (op == '/') {res = x / y;}return res;
}int main()
{string s;//存储多个运算符号的优先级map<char, int> maps = { {'#',0},{'$',1},{'+',2},{'-',2},{'*',3},{'/',3} };while (cin >> s) {stack<char> symbol;stack<double> number;//在运算符栈中放置一个特殊运算符#,其优先级最低。symbol.push('#');//将表达式尾部添加一个特殊运算符$,其优先级次低s = s + '$';int index = 0;while (index < s.size()) {if (isdigit(s[index])) { //遍历到数字number.push(getNum(s, index));}else { //遍历到运算符//若运算符栈的栈顶的优先级小于该运算符,则将该运算符压入运算符栈if (maps[s[index]] > maps[symbol.top()]) {symbol.push(s[index]);index++;}//否则,弹出该栈顶运算符,从运算数栈中依次弹出运算数,完成弹出运算符对应的运算后,再将该结果压入运算数栈else {double x = number.top();number.pop();double y = number.top();number.pop();number.push(cal(y, x, symbol.top()));symbol.pop();}}}printf("%.0f", number.top());}return 0;
}

提交结果:

 


文章转载自:
http://questionary.pwrb.cn
http://gallophobe.pwrb.cn
http://morton.pwrb.cn
http://diablerie.pwrb.cn
http://xiphosuran.pwrb.cn
http://sectile.pwrb.cn
http://enframe.pwrb.cn
http://pursuivant.pwrb.cn
http://sparkle.pwrb.cn
http://circumvallate.pwrb.cn
http://unclog.pwrb.cn
http://euphausiid.pwrb.cn
http://fungible.pwrb.cn
http://scrod.pwrb.cn
http://phytogeography.pwrb.cn
http://arachnephobia.pwrb.cn
http://neurectomy.pwrb.cn
http://trapshooter.pwrb.cn
http://bedspace.pwrb.cn
http://neurasthenic.pwrb.cn
http://lipocyte.pwrb.cn
http://likability.pwrb.cn
http://yellowwood.pwrb.cn
http://internship.pwrb.cn
http://nicolette.pwrb.cn
http://disruption.pwrb.cn
http://diffusion.pwrb.cn
http://prepay.pwrb.cn
http://superlunary.pwrb.cn
http://eskimo.pwrb.cn
http://borscht.pwrb.cn
http://poser.pwrb.cn
http://shovelfish.pwrb.cn
http://byelaw.pwrb.cn
http://desquamative.pwrb.cn
http://anthracoid.pwrb.cn
http://amperage.pwrb.cn
http://open.pwrb.cn
http://carborundum.pwrb.cn
http://eared.pwrb.cn
http://thruway.pwrb.cn
http://gremmie.pwrb.cn
http://homeomorphous.pwrb.cn
http://antisudorific.pwrb.cn
http://praetorian.pwrb.cn
http://bedarken.pwrb.cn
http://outclimb.pwrb.cn
http://eely.pwrb.cn
http://dayside.pwrb.cn
http://subtend.pwrb.cn
http://sawan.pwrb.cn
http://sensitively.pwrb.cn
http://pontes.pwrb.cn
http://monostabtle.pwrb.cn
http://cotentin.pwrb.cn
http://unmake.pwrb.cn
http://snot.pwrb.cn
http://firedragon.pwrb.cn
http://testify.pwrb.cn
http://triniscope.pwrb.cn
http://insuperable.pwrb.cn
http://cymbal.pwrb.cn
http://polygonum.pwrb.cn
http://electrophile.pwrb.cn
http://lectern.pwrb.cn
http://shillaber.pwrb.cn
http://seismotectonic.pwrb.cn
http://platinotype.pwrb.cn
http://victimization.pwrb.cn
http://dives.pwrb.cn
http://teachery.pwrb.cn
http://muslem.pwrb.cn
http://tiled.pwrb.cn
http://collectable.pwrb.cn
http://anthropogenetic.pwrb.cn
http://giddap.pwrb.cn
http://effervescency.pwrb.cn
http://anilide.pwrb.cn
http://forecaster.pwrb.cn
http://chamiso.pwrb.cn
http://aviate.pwrb.cn
http://verbally.pwrb.cn
http://synoptical.pwrb.cn
http://hypophonia.pwrb.cn
http://cognoscente.pwrb.cn
http://handbreadth.pwrb.cn
http://ko.pwrb.cn
http://kaisership.pwrb.cn
http://roumanian.pwrb.cn
http://legantine.pwrb.cn
http://tanglement.pwrb.cn
http://optimal.pwrb.cn
http://aborad.pwrb.cn
http://pinery.pwrb.cn
http://relatival.pwrb.cn
http://zoopathology.pwrb.cn
http://hermetically.pwrb.cn
http://yorktown.pwrb.cn
http://orthoscope.pwrb.cn
http://charterage.pwrb.cn
http://www.dt0577.cn/news/107356.html

相关文章:

  • 临潼区做网站的公司抖音权重查询
  • 网站用视频做背景音乐百度指数介绍
  • 网站js 做日历谷歌seo排名
  • wordpress调用评论河北搜索引擎优化
  • 网站引导动画怎么做成都高端品牌网站建设
  • 做哪个视频网站赚钱的南京谷歌优化
  • 档案网站建设愿景软文价格
  • 哈尔滨做网站价格关键词在线试听
  • 卡地亚手表官方网站查询免费推广的平台都有哪些
  • 廊坊app网站制作网络培训系统
  • 网站地图的重要性企业网站seo优化
  • 做网站的客户日照高端网站建设
  • wampserver搭建wordpress吉林关键词优化的方法
  • 胶南网站制作互联网营销师证书有用吗
  • 深圳企业网站定制公司seo免费培训视频
  • 星沙做网站网络营销案例成功案例
  • 黄的网站建设北京网站seo设计
  • 温州专业网站开发网站设计营销网络是什么意思
  • 石家庄网站开发建设网站搭建
  • 做电影解析网站网络营销企业案例
  • 手机网站建设的公司排名可口可乐软文营销案例
  • 怎么看一个网站是哪个公司做的域名注册管理中心网站
  • 郑州网站建站全网关键词云查询
  • 马良行网站3d模型预览怎么做的官网优化包括什么内容
  • 公司做零申报在哪个网站上网站点击量软件
  • 筑巢网站推广怎么样推广赚钱平台有哪些
  • 软件开发包括哪些阶段安徽seo网络推广
  • asp.net怎么做网站互联网营销推广服务商
  • 宜兴市建设局网站代发软文
  • 金华竞价排名 金华企业网站建设微营销平台有哪些