Home > Back-end >  Discrete experiment: by true value assignment of proposition formula, to solve the actual problem (u
Discrete experiment: by true value assignment of proposition formula, to solve the actual problem (u

Time:09-21

#include
#include
Int k=1, n, m, a [1001], o=0, e=0, f=1; Char b [101] [101], c [101] [101], [10001] h, d [10001];
Int a1 (int p, int q)//a - & gt; B
{
If (p==0 | | q==1) return 1;
The else return 0;
}
Int a2 (int p, int q)//a& & B
{
If (p + q==2) return 1;
The else return 0;
}
Int a3 (int p, int q)//a | | b
{
If (p==1 | | q==1) return 1;
The else return 0;
}
Int suanfa (int v)
{
Int p=1, I=v - 1, q=1, j.
For (; I & gt;=0; I -)
If (h [I]=='(')
{
F=I; break;
}
For (i++; i{
J=0;
If (h [I]=='+') {i++; continue; }
If (h==[I] '^')
{
I +=1;
While (h [I]=='-')
{
J++; i++;
}
If (j % 2==0 & amp; & A [h [I] - 'a'] | | j % 2 & amp; & A [h [I] - 'a']==0) q=1;
The else q=0;
I +=1;
P=a2 (p, q);
}
Else if (h [I]=='-')
{
I +=2;
While (h [I]=='-')
{
i++; J++;
}
If (j % 2==0 & amp; & A [h [I] - 'a'] | | j % 2 & amp; & A [h [I] - 'a']==0) q=1;
The else q=0; i++;
P=a1 (p, q);
}
Else if (h==[I] 'V')
{
I +=1;
While (h [I]=='-')
{
J++; i++;
}
If (j % 2==0 & amp; & A [h [I] - 'a'] | | j % 2 & amp; & A [h [I] - 'a']==0) q=1;
The else q=0;
I +=1;
P=a3 (p, q);
}
Else if (h [I]=='-')
{
While (h [I]=='-') {j++; i++; }
If (j % 2==0 & amp; & A [h [I] - 'a'] | | j % 2 & amp; & A [h [I] - 'a']==0) p=1;
The else p=0; i++;
}
Else if (h [I] & gt;='a' & amp; & H [I] <='z') {p=a/h [I] - 'a'; i++; }
}
For (I=f; I & lt;=v; I++)
H [I]='+';
If (p==1) {h [f]='a' + n. }
The else h [f]='a' + n + 1;
return 0;
}
Int (aa)
{
int i;
For (I=0; F& & H [I]; I++)
If (h [I]==') ')
{
Suanfa (I);
}
return 0;
}
Int yunsuan (int l)
{
F=1;
Int I=0, j;
For (I=0; D [I]; I++)
H=d [I] [I];
H [I]=0;
If (l==n)
{
(aa);
If (a [h [0] - 'a'])
{
J=k;
For (I=0; iIf (a [I])
{
If (j)==k
{
Puts (" "); Printf (" package % d \ n ", k); k++;
}
Printf (" : "); Printf (" % s \ n ", [I] b);
}
}
return 0;
}
A [l]=0;
Yunsuan (l + 1);
A [l]=1;
Yunsuan (l + 1);
return 0;
}
Int main ()
{
Puts (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ");
Puts (" * * * * * * * * ");
Puts (" * * * * "welcome to the logical operation" * * * * ");
Puts (" * * * * * * * * ");
Puts (" * * * * use uppercase 'V' representative or operation * * * * ");
Puts (" * * * * in '- & gt; 'for contains the operation * * * * ");
Puts (" * * * * in '~' represents the operation * * * * ");
Puts (" * * * * in '^' representatives and operation * * * * ");
Puts (" * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ");
Puts (" ");
int i;
Puts (" please enter a number on behalf of the company, send a few people to ");
The scanf (" % d ", & amp; N); A [n]=1; A [n + 1)=0;
Printf (" please input the name of the % d personal \ n ", n);
For (I=0; i{
Printf (" proposition % c \ n ", 'a' + I);
The scanf (" % s ", b [I]);
}
Puts (" please enter a number on behalf of the company sent the condition number ");
The scanf (" % d ", & amp; M);
Printf (" please enter the % d condition \ n ", m);
H [0]='('; H='(' [1];
For (I=0; i{
The scanf (" % s ", c [I]);
Strcat (h, c [I]);
If (I==m - 1) strcat (h, ") ");
Else strcat (h,) ^ (" ");
}
Strcat (d, h);
Yunsuan (0);
Puts (" ");
return 0;
}

CodePudding user response:

As the same code as you see friends that school

CodePudding user response:

Classmate, where do you see the code?
  • Related