!(something AND something)
是NAND
門,他們可以在你的情況來表示,以!something OR !something
所以
while (!(input[i] == '*' && input[i+1] == '/')) {
相同
//Pick your syntax from these 2 options
while (input[i] != '*' || input[i+1] != '/')
while (!(input[i] == '*') || !(input[i+1] == '/'))
如何過渡從和T o或工作。
現在考慮一下你的NAND門是與輸入X和Y非NOT門的AND門。結果是兩個輸入的AND和AND。爲了區分兩個輸入OR,你必須做下列步驟操作:
____ __
x --| \ | \
| AND |---|NOT|--- (NAND)
y --|____/ |__/
- 變化和OR
- 通過不刪除或者刪除門或否定再次輸出
- 取反每個輸入separatelly
然後你會得到:
x --- NOT GATE --- \
-- OR GATE -- NOT (from NAND) -- NOT (negate output)
y --- NOT GATE ---/
- 如果你想做相反的事情,你可以做到這一點(NOR和AND),只需交換OR和AND以及所有其他步驟。
感謝您澄清。感覺太合乎邏輯了吧!這是錯誤的。 –