Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "Operatory logiczne mozliwe do uzycia ( Koniunkcja, alternatywa, implikacja, rownowaznosc )"
- i=0
- p=0
- numzm=0
- tab=( )
- tabvalue=( )
- expression=""
- pobierz_wyrazenie() {
- echo "Wprowadz wyrazenie logiczne:"
- read expression;
- }
- # {
- testowanie_tautologi() {
- for I in tab
- do
- if [ !${#tab[i]} ]
- then
- p=1;
- fi
- done
- if [ !p ]
- then
- return 1;
- fi
- for I in tab
- do
- if [ ${#tab[i]} ]
- then
- p=1;
- fi
- done
- if [ !p ]
- then
- return 2;
- fi
- return 0;
- # }
- }
- # PROGRAM !
- zm1=0
- #pobierz_wyrazenie expression
- if [ zm1==1 ]
- then
- pobierz_wyrazenie expression
- fi
- if [ testowanie_tautologi tabvalue numzm == 1 ]
- then
- echo "Podane Wyrazenie jest tautologia"
- elif [ testowanie_tautologi tabvalue numzm == 2 ]
- then
- echo "Podane wyrazenie nie jest tautologia"
- else
- echo "Podane Wyrazenie jest niewlasciwe"
- if [ zm1 != 2 ]
- then
- echo "Prosze podac dokladnie jedno wyrazenie logiczne"
- return 0;
- fi
- if [ testowanie_tautologi tabvalue numzm == 1 ]
- then
- echo "Podane wyrazenie jest tautologia"
- elif [ testowanie_tautologi tabvalue numzm == 2 ]
- then
- echo "Podane wyrazenie jest sprzeczne"
- else
- echo "Podane wyrazenie jest niewlasciwe"
- fi
- return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement