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

网站目录字典在线查企业信息查询平台

网站目录字典,在线查企业信息查询平台,郴州58网站,4a景区网站建设标准本作业主要考察#xff1a;解释器模式的实现思想/栈结构在表达式求值方面的绝对优势 C数据结构与算法夯实基础作业列表 通过栈的应用#xff0c;理解特定领域设计的关键作用#xff0c;给大家眼前一亮的感觉。深刻理解计算机语言和人类语言完美结合的杰作。是作业中的上等…本作业主要考察解释器模式的实现思想/栈结构在表达式求值方面的绝对优势 C数据结构与算法夯实基础作业列表 通过栈的应用理解特定领域设计的关键作用给大家眼前一亮的感觉。深刻理解计算机语言和人类语言完美结合的杰作。是作业中的上等作品是数据结构与算法的典型代表。 这个作业是我最心爱的一个。因为我有个盗版Win10居然打不开计算器还有就是一些高级比如指数运算怕不会操作Windows的自带计算器算错要用自己的计算器再验证一遍第三个就是Windows的计算器不支持回车键和命令行我的就可以回车一下就行Windows的总是要鼠标点来点去烦不胜烦。 需求如下 实现表达式求值的计算器以支持加、减、乘、除、指数幂、括号6种操作。 实现代码完成下面的测试用例要求和预期输出结果一致 接口提示可以自行定义接口只要实现合理能实现需求就行 Stackitem.h #pragma once#include iostream //ostream using namespace std;templatetypename T class CStack;templatetypename T class CStackitem { public:friend class CStackT;CStackitem(void);CStackitem(T _data);CStackitem(const CStackitem _item);~CStackitem(void);const T GetData(void) const;private:CStackitem operator(const CStackitem _item);//disallow a b;private:CStackitem* pPre;CStackitem* pNext;T data; };Stack.h #pragma once#include Stackitem.htemplatetypename T class CStack { public:CStack(void);CStack(const CStack _stack);~CStack(void);public:const T top(void) const;bool empty(void) const;size_t size(void) const;void push(const CStackitemT _item);const T pop(void);private:CStack operator(const CStack _stack);//a b; is not allowedprivate:CStackitemT* m_pTail;size_t m_size; }; Calculator.h #pragma once#include iostream #include list #include string #include sstream using namespace std;#include ExpressionException.htypedef liststring Expression;ostream operator(ostream _os, const Expression _item);class Calculator { public:Calculator(const char* _infix);Calculator(const string _infix);~Calculator(void);public:string GetExpression(void) const;void SetExpression(const string _expression);templatetypename TT GetValue(void ) const;Expression ToPostfix(void) const;public:static Expression ToPostfix(const string pre);static bool Check(const string _expression, string _invalidInfor);private:static void ToPostfix(const string pre, Expression post);static bool IsOperator(char op); // 判断是否为运算符 static int Priority(char op); // 求运算符优先级 static void ReadSpace(string::const_iterator _itr, string::const_iterator _end);static void ReadNumber(string::const_iterator itr, string::const_iterator _end, string _value);private:string m_infix; }; main.cpp #include iostream #include string #include cassert #include list using namespace std;#include Stack.h #include Calculator.hvoid InputAndCalculator(listCalculator listCalculator); void Output(const listCalculator listCalculator); void TestAll(listCalculator listCalculator);int main(int argc, char** argv) {coutsupport: - * / ^ ( )endl;coutInput 0 for end your input.endl;listCalculator listCalculator;InputAndCalculator(listCalculator);//Extra credit 1:(1)any space (2)catch invalid inputreturn 0; } void InputAndCalculator(listCalculator listCalculator) {while (true){string sLine, invalidInfor;getline(cin, sLine);if (Calculator::Check(sLine, invalidInfor) false)//Extra credit 1:(1)any space (2)catch invalid input{coutinvalidInforendl;continue;}listCalculator.push_back(sLine);Output(listCalculator);listCalculator.clear();} } 参考答案 C表达式求值Stack and Expression​ blog.csdn.net/calmreason/article/details/78163268​编辑
http://www.pierceye.com/news/258445/

相关文章:

  • 网站设计培训成都哪个网站开发软件
  • 四川炜航建筑公司网站新郑网络推广外包
  • 网站建设名头网站项目建设方案
  • 可以用asp做哪些网站简历模板大学生免费
  • 公司 宜宾网站建设头条小程序
  • 大连h5建站学院网站建设申请报告
  • 大蒜做营销型网站贵州最好的网站建设推广公司
  • 单仁资讯做网站怎样备案网站应用服务
  • 如何生成一个网站怎么查看一个网站有没有做推广
  • 温州网站设计案例wdcp创建多个网站
  • 做个公司网站专业做网站app的公司
  • 动漫网站源码下载莱芜金点子最新招工信息
  • 小区住宅可以注册公司吗简述seo的概念
  • 做农村电商要多少钱南宁软件优化网站
  • 网站系统建设技术服务费网站建设 专项资金变更
  • 网站建设画册怎么用eclipse做网页
  • 百度网站安全检测平台广州番禺营销型网站建设
  • 杭州大的做网站的公司甘肃省住房和城乡建设部网站首页
  • 网站建设与网页设计考试题棋牌软件开发搭建
  • 短链接生成网址wordpress主叶SEO优化
  • 免费的cms视频网站做cpa怎么建立自己网站
  • 在哪里找做网站的北京的招聘网站有哪些
  • 做旅行网站aspx网站开发
  • 网站接入服务器商查询wordpress更换端口
  • 网站网页设计师武义县网站建设
  • 中铁建设集团有限公司官网建站到网站收录到优化
  • 做seo网站要多少钱网页设计师好吗
  • 建设部网站 绿色建筑评价表哪里页面设计培训好
  • 西部数码网站源码虹桥做网站公司
  • 生鲜网站开发wordpress mysql 链接