怎么转成中缀表达式(要疯了)
#include<bits/stdc++.h>
#define rll register long long
#define ll long long
using namespace std;
char s[100005],w[100005],l[100005];
deque <char>q;
int main(){
rll i=0,n,tmp,len=0,op=0;
gets(s);
scanf("%lld",&n);
for(i=0;i<strlen(s);i++){
if(s[i]=='x'){
scanf("%lld",&tmp);
w[len++]=tmp+'0';
i+=2;
}
w[len++]=s[i];
}
cout<<"w="<<w<<endl;
for(i=0;i<len;i++){
if(w[i]==' ')continue;
if(w[i]=='&'||w[i]=='|'||w[i]=='!'){
l[op++]=q.front();q.pop_front();
l[op++]=w[i];
l[op++]=q.front();q.pop_front();
}else{
q.push_back(w[i]);
}
}
cout<<"l="<<l<<endl;
return 0;
}