- 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
您可能关注的文档
最近下载
- 2026年郑州电力高等专科学校单招职业技能笔试模拟试题带答案详解.docx VIP
- 2025至2030中国民办高校行业发展研究与产业战略规划分析评估报告.docx VIP
- (人教版八年级物理)第六章 质量与密度 第2节 密度 同步练习.docx VIP
- 统编版(2024)一年级下册阅读11浪花 课堂实录.docx VIP
- 2026年郑州电力高等专科学校单招职业技能考试题库有答案解析.docx VIP
- 拔尿管操作流程.pptx VIP
- 云投集团笔试题型及答案.doc VIP
- 四川省成都市第七中学2024-2025学年度下期高2026届半期考试 物理下期半期考试试卷.pdf VIP
- 诊所护士聘用合同.doc VIP
- (河北专版)中考物理总复习 第9讲 质量与密度优质课件.pptx VIP
原创力文档

文档评论(0)