Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
int main(){

//Menu de opções [por @fonzaex]
int opcao;
int opcao = 1;

while(opcao>=1){
printf("\n=======================================================\n");
Expand All @@ -49,6 +49,10 @@ int main(){
relacao_01();
relacao_02();
relacao_03();
relacao_04();
relacao_05();
relacao_06();
relacao_07();
break;
default:
opcao=-5;
Expand All @@ -58,7 +62,7 @@ int main(){
printf("=======================================================\n");
break;
}
}
};

return 0;
}
101 changes: 78 additions & 23 deletions propriedades.h
Original file line number Diff line number Diff line change
@@ -1,33 +1,88 @@
#ifndef _PROPRIEDADES_H
#define _PROPRIEDADES_H

//Função ehReflexiva [por @fonzaex]
//[Adaptada por @bispojr]
int ehReflexiva(int rho2[][2]);
int ehReflexiva(int rho2[][2]){ // funcao para verificar se eh reflexiva, return 0 = falso, return 1 = verdade.

//AINDA FALTA PASSAR O VALOR DO CONJS POR REFERENCIA E VERIFICAR SE TODO X PERTENCE AO COJUNTO S;
//MOSTRANDO OS SUBCONJUNTOS, EM FORMA DE MATRIZ

//UNICA LOGICA QUE ACHEI FOI ESSA, DEVE-SE IMPLEMENTAR EM CIMA NOS LAÇOS FOR
if(rho2[0][0]==rho2[0][1] && rho2[1][0]==rho2[1][1] && rho2[2][0]==rho2[2][1]){
return 1;
}
else{
return 0;
}
//@hcb13
int ehReflexiva(int conjS[], int tam_conj, int rho[][2], int qtd_pares ){
int i;//percorrer o conjunto
int j;//percorrer rho
int c;//simular os pares
for( i = 0; i < tam_conj; i++ ){
c = conjS[i];
for( j = 0; j < qtd_pares; j++){
if( (rho[j][0] == c ) && ( rho[j][1] == c ) ){
break;//axou um par reflexivo
}
}
if( j == qtd_pares ){
return 0;//nao encontrou par reflexivo
}
}
return 1;//eh reflexiva a relacao
}
int ehSimetrica(){ // funcao para verificar se eh simetrica, return 0 = falso, return 1 = verdade.
return 1;

int ehSimetrica(int conjS[], int rho[][2], int qtd_pares ){
int i, j, x, y;
for( i = 0; i < qtd_pares; i++ ){
x = rho[i][0];
y = rho[i][1];
for( j = 0; j < qtd_pares; j++ ){
if( ( x == rho[j][1] ) && ( y == rho[j][0] ) ){
break;//axou o par simetrico
}
}
if( j == qtd_pares ){
return 0;//nao axou par simetrico a x e y
}
}
return 1;
}
int ehTransitiva(){ // funcao para verificar se eh transitiva, return 0 = falso, return 1 = verdade.
return 0;

int ehTransitiva( int conjS[], int rho[][2], int qtd_pares){
int i, j, p, x1, y1, y2, z2;
for( i = 0; i < qtd_pares; i++){
x1 = rho[i][0];
y1 = rho[i][1];
for( j = 0; j < qtd_pares; j++ ){
y2 = rho[j][0];
if( y1 == y2 ){
z2 = rho[j][1];
for( p = 0; p < qtd_pares; p++ ){
if( ( x1 == rho[p][0] ) && ( z2 == rho[p][1] ) ){
break;//encontrou par transitivo
}
}
if( p == qtd_pares ){
return 0;//nao encontrou
}
}
}
}
return 1;//eh transitiva
}
int ehAntiSimetrica(){ // funcao para verificar se eh anti-simetrica, return 0 = falso, return 1 = verdade.
return 1;

int ehAntiSimetrica( int conjS[], int rho[][2], int qtd_pares){
int i, j, x, y;
for( i = 0; i < qtd_pares; i++ ){
x = rho[i][0];
y = rho[i][1];
for( j = 0; j < qtd_pares; j++ ){
if( ( x == rho[j][1] ) && ( y == rho[j][0] ) ){
if( x == y ){
break;//encontrou o par anti-simétrico
}else{
return 0;
}
}
}
}
return 1;

}
int ehEquivalencia(){ // funcao para verificar se eh anti-simetrica, return 0 = falso, return 1 = verdade.
return 0;

int ehEquivalencia(int conjS[], int tam_conj, int rho[][2], int qtd_pares){
if( (ehReflexiva(conjS, tam_conj, rho, qtd_pares) ) && ( ehSimetrica(conjS, rho, qtd_pares) ) && ( ehTransitiva(conjS, rho, qtd_pares) ) ){
return 1;
}
}

#endif
Loading