#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define N 1005
#define ll long long
char str[N];
char sta[N];
char a[N];
void houzhui()//数组模拟栈求后缀表达式
{
int top = 0;
while (top) top--;
int len=strlen(str);
int k=0;
// printf("len = %d\n", len);
int i;
for(i = 0; i<len; i++)
{
if(str[i]>='a'&&str[i]<='z')
{
a[k++]=str[i];
// printf("%c", a[k-1]);
}
else if(str[i]==')')
{
while (sta[top]!='(')
{
a[k++]=sta[top];
top--;
}
top--;
}
else
{
if (str[i]=='-'&&str[i]!='>')
{
while (top&&sta[top]=='-')
{
a[k++]=sta[top];
top--;;
}
sta[++top] = str[i];
continue;
}
else if (str[i]=='<')
{
while (top&&sta[top]!='(')
{
a[k++]=sta[top];
top--;;
}
sta[+
根据表达式求出真值表及主析取主合取——离散数学实训
最新推荐文章于 2022-09-11 18:10:04 发布