-
Notifications
You must be signed in to change notification settings - Fork 0
/
tautology.c
37 lines (31 loc) · 900 Bytes
/
tautology.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<stdio.h>
int main (void)
{
char exp[100];
int res=-1, lock=0;
printf("\nEnter the expression: ");
scanf("%s",&exp);
res=tautalogy(exp,0,strlen(exp));
if(res==0)
prinf("Not a tautology!");
else
prinf("It's a tautology!");
return 0;
}
int tautalogy(char exp[],int l, int h)
{
for(int index=0; index<strlen(exp), i++)
{
if(exp[index] == '(')
{
//search for respective ')' and call this function with that set of exp recursively
}
if(exp[index] == '&' || exp[index] == '&')
{
//get last two chars at both left and right.
//search for ! in both sides two chars
//perform operation (| or &) based on value
//increment i to the position after the processed variable
}
}
}