'*' means && (AND)
'+' means || (OR)
'T' and 'F' mean true and false (1 & 0).
'*' (&&) comes before '+' (||),
between 2 values (F or T) will always be an operator ('+' or '*')
example: T*F+F*T*T*F=(true&&false)|| (false&&true&&true&&false)
The program will receive a number of strings, containing logic expressions.
the character '=' separates between expressions and there could be spaces
inside the input strings and between them.
The number of strings in the input file is unknown. The program shall read until
the end of the file.
The program will:
1. print each expression on a different row, reducing spaces (if they exist). In the end
of each expression it will print '='.
2. calculate the result of each expression and print it after the '=' character.
example: for the stream "T*F+F*T*T*F=T+F+F+T*T*T+T=F+T+F*F+T=", the program
There is no need to check if the input is ok (except cropping spaces). No need for interpreters, tokens, data types and recursion. I can only use loops/ifs and functions...
cant come up with a decent way to solve and save the logic expression.
Till now i've just substituted all the "F"s and "T"s with
1's and 0's in a temp string, so now im able to use C's && and
|| operators on the input string. but what to do next?
btw, i use borland turbo cpp 3.0 as an ide and a compiler.