程序设计方法学简易计算器.docVIP

  • 5
  • 0
  • 约4.94千字
  • 约 9页
  • 2016-04-11 发布于重庆
  • 举报
程序设计方法学简易计算器

实验1 简易计算器: 第一步: 程序基本架构: #include iostream #include fstream #include string using namespace std; #define MAXLENGTH 1024 bool fail = false; //数据结构: //操作数栈 struct stack_c{ char data[MAXLENGTH]; int top; } od; //操作符栈 struct stack_d{ double data[MAXLENGTH]; int top; } op; int main() { ifstream infile; ofstream outfile; string expr; infile.open(infile.txt); outfile.open(calc.log); if (infile.fail()) { outfile 无法读取表达式! endl; } else { while (!infile.eof()) { infile expr; calc(expr); outfile endl endl; } } infile.close(); outfile.close(); return 0; } 第二步:对calc(e

文档评论(0)

1亿VIP精品文档

相关文档