diff --git a/Quadra.c b/Quadra.c index e0da21d1f9d96087be5ff84d8190e110bc82735b..904efb40113dec94da7e7d4b523d69c39b93c237 100644 --- a/Quadra.c +++ b/Quadra.c @@ -1,5 +1,6 @@ #include "busca.h" #include <time.h> + FILE *log; void vetSort(int *vet, int *vet_ord, int Tam, int max) @@ -28,28 +29,39 @@ void jogar (int *vet, int *vet_ord, int N) { int x, i = 0, j; printf ("Entre com a Quadra de valores: "); - fputs(" O usuario entrou com os seguintes valores : \[ ",log); - for (j = 0; j < 4; j++) + fprintf(log, " O usuario entrou com os seguintes valores : ["); + for (j = 0; j < 3; j++) { scanf ("%d", &x); fprintf(log,"%d, ", x); - fprintf(log + // fprintf(log if ((pesqseq(vet, x, N) != 0) || (pesqbin(vet_ord, x, N) != 0)) i++; } - fputs("\]\n",log); + scanf ("%d", &x); + fprintf(log, "%d]\n",x); + if ((pesqseq(vet, x, N) != 0) || (pesqbin(vet_ord, x, N) != 0)) + i++; if (i == 4) + { printf ("Sucesso!!\n"); fprintf(log,"Sucesso! Os numero inseridos estao contidos no vetor\n"); + } else if (i > 1) + { printf ("%d valores encontrados!\n", i); fprintf (log,"%d valores encontrados!\n", i); + } else if (i == 1) + { printf ("1 valor encontrado!\n"); fprintf (log,"1 valor encontrado!\n"); + } else + { printf ("Nenhum valor encontrado!\n"); fprintf (log,"Nenhum valor encontrado!\n"); + } } void vetcpy (int *v1, int *v2, int N) diff --git a/busca.o b/busca.o index 90ac0aa251a1e0fa3d616af1f9dfda3f0ae11b83..4966c7712a2bf058db8ca485324678a2cce145a3 100644 Binary files a/busca.o and b/busca.o differ diff --git a/libbusca.a b/libbusca.a index a2553d89037bc25e1342e7ee2d1510f735bba2e6..fcb69dc691f74e4b718c8359085470ee5b3ab624 100644 Binary files a/libbusca.a and b/libbusca.a differ