📄 main.cpp
字号:
#include <iostream>
#include<cmath>
using namespace std ;
#include "stack.h"
#include "sufficalExpression.h"
#include "countExpression.h"
#include "changeExpression.h"
void main()
{
stackList<char> stackList1 ;//
stackList<float> stackList2 ;
char input = NULL;
bool result ;
cout<<"请输入表达式 以 = 号结束"<<endl;
//一边输入一边入栈
while(input != '=')
{
cin>>input ;
stackList1.push(input) ;
if((input <= '9')&&(input>='0'))
stackList1.setType(0);
else
stackList1.setType(1);
}
//将刚输入的栈进行处理
changeStack(stackList1,stackList2) ;
//将表达式转成后缀式 并判断是否成功
result = changeToSufficalExpression(stackList2);
if(result)
{
//如果转换成功则进行运算
cout<<Account_Suffixal(stackList2);
}
else
{
cout<<"表达式存在错误";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -