diff --git a/Quadra.c b/Quadra.c index f8da7f6280c8d2aabcdbf202ca469832736f8c40..ab53871f00f25946db5d88e64aaa478442d2994f 100644 --- a/Quadra.c +++ b/Quadra.c @@ -1,7 +1,6 @@ #include "busca.h" #include <time.h> -FILE *log; void vetSort(int *vet, int *vet_ord, int Tam, int max) { @@ -14,7 +13,7 @@ void vetSort(int *vet, int *vet_ord, int Tam, int max) } } -void imprime (int *vet, int N) +void imprime (int *vet, int N,FILE *log) { int i; for (i = 1; i <= N; i++) @@ -25,9 +24,9 @@ void imprime (int *vet, int N) } } -void jogar (int *vet, int *vet_ord, int N) +void jogar (int *vet, int *vet_ord, int N,FILE *log) { - int x, i = 0, j; + int x, i = 0, j, vetor[4]; printf ("Entre com a Quadra de valores: "); fprintf(log, " O usuario entrou com os seguintes valores : ["); for (j = 0; j < 3; j++) @@ -35,16 +34,19 @@ void jogar (int *vet, int *vet_ord, int N) scanf ("%d", &x); fprintf(log,"%d, ", x); if ((pesqseq(vet, x, N) != 0) || (pesqbin(vet_ord, x, N) != 0)) + vetor[i]=x; i++; + } scanf ("%d", &x); fprintf(log, "%d]\n",x); if ((pesqseq(vet, x, N) != 0) || (pesqbin(vet_ord, x, N) != 0)) + vetor[3]=x; i++; if (i == 4) { - printf ("Sucesso!!\n"); - fprintf(log,"Sucesso! Os numero inseridos estao contidos no vetor\n"); + printf ("Sucesso!! [%d %d %d %d]\n", vetor[0], vetor[1], vetor [2], vetor [3] ); + fprintf(log,"Sucesso! Os numero inseridos estao contidos no vetor: [%d %d %d %d]\n", vetor[0], vetor[1], vetor [2], vetor [3] ); } else if (i > 1) { @@ -77,7 +79,7 @@ int tempoEmMic(clock_t inicio, clock_t fim) return tt; } -void jornada(int Tam, int max) +void jornada(int Tam, int max, FILE *log) { clock_t ti, tf; int i, *mat[10000], *mat_ord[10000], tt; @@ -128,24 +130,25 @@ void jornada(int Tam, int max) int main (void) { + FILE *log; int Tam, max, *vet, *vet_ord; int menu; log = fopen("log.txt","w"); - fputs(" =================================================================================\n - Inicio da execucao: programa que implementa as especificacoes do trabalho 2.\n - Cristopher Luis Mattoso, Matheus Horstmann\n - ==================================================================================\n",log)/ + fputs("==================================================================================\n",log); + fputs(" Inicio da execucao: programa que implementa as especificacoes do trabalho 2.\n",log); + fputs(" Cristopher Luis Mattoso, Matheus Horstmann\n",log); + fputs("===================================================================================\n",log)/ printf ("Entre com tamanho de vetor: "); scanf ("%d", &Tam); - fprintf(log, "O usuario escolheu um vetor de tamanho %d",Tam); + fprintf(log, "O usuario escolheu um vetor de tamanho %d\n",Tam); printf ("Entre com valor maximo dos numeros aleatorios: "); scanf ("%d", &max); - fprintf(log, "O usuario escolheu valor maximo que o vetor pode ter, esse valor eh : %d",max); + fprintf(log, "O usuario escolheu valor maximo que o vetor pode ter, esse valor eh : %d\n",max); vet = (int *) malloc ((Tam+1) * sizeof(int)); vet_ord = (int *) malloc ((Tam+1) * sizeof(int)); vetSort(vet, vet_ord, Tam, max); QuickSort_it(vet_ord, Tam); - fprintf(log,"Foi alocado 2 vetores de tamanho %d com o valor maximo de %d, com os numeros sorteados, sendo um deles já ordenado",Tam,max); + fprintf(log,"Foi alocado 2 vetores de tamanho %d com o valor maximo de %d, com os numeros sorteados, sendo um deles já ordenado\n",Tam,max); printf ("\nMenu:\n"); menu = 1; while (menu != 0) @@ -159,20 +162,20 @@ int main (void) break; case 2: - fputs("O usuario escolheu a opcao 2, e foi exibido o vetor sorteado de numeros aleatorios",log); - imprime (vet, Tam); + fputs("O usuario escolheu a opcao 2, e foi exibido o vetor sorteado de numeros aleatorios\n",log); + imprime (vet, Tam,log); break; case 3: - fputs("O usuario escolheu a opcao 3, e foi exibido o vetor sorteado de numeros aleatorios ordenado",log); - imprime (vet_ord, Tam); + fputs("O usuario escolheu a opcao 3, e foi exibido o vetor sorteado de numeros aleatorios ordenado\n",log); + imprime (vet_ord, Tam, log); break; case 4: - fputs("O usuario escolheu a opcao 4, e comeca o jogo.",log); - jogar (vet, vet_ord, Tam); + fputs("O usuario escolheu a opcao 4, e comeca o jogo.\n",log); + jogar (vet, vet_ord, Tam, log); break; case 5: - fputs("O usuario escolheu a opcao 5, e comeca a jorndada de 10.000 vetores",log); - jornada(Tam, max); + fputs("O usuario escolheu a opcao 5, e comeca a jorndada de 10.000 vetores\n",log); + jornada(Tam, max, log); break; } printf ("\nNova Entrada: "); diff --git a/Quadra.exe b/Quadra.exe index 11978c9bf0d50dc6b84aa72069e8426b7de9c339..5e212b7bbebedc3e7e5e62cbc61cbc8f84985d11 100755 Binary files a/Quadra.exe and b/Quadra.exe differ diff --git a/Quadra.exe.dSYM/Contents/Info.plist b/Quadra.exe.dSYM/Contents/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..a0ebb1ff9e10f66365ec33b0f8a1f805c513895d --- /dev/null +++ b/Quadra.exe.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> + <dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleIdentifier</key> + <string>com.apple.xcode.dsym.Quadra.exe</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>dSYM</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleVersion</key> + <string>1</string> + </dict> +</plist> diff --git a/Quadra.exe.dSYM/Contents/Resources/DWARF/Quadra.exe b/Quadra.exe.dSYM/Contents/Resources/DWARF/Quadra.exe new file mode 100644 index 0000000000000000000000000000000000000000..7189c43eca378d85a242a9aee1ff3b1d1c31c4b8 Binary files /dev/null and b/Quadra.exe.dSYM/Contents/Resources/DWARF/Quadra.exe differ diff --git a/libbusca.a b/libbusca.a index 2c7c4c5a1f7bb3c9315d63d722797f7e38e878e0..d5ea33ac619508cd4a859a4559012dde5366a1e0 100644 Binary files a/libbusca.a and b/libbusca.a differ diff --git a/log.txt b/log.txt new file mode 100644 index 0000000000000000000000000000000000000000..c52f6c0d40cf285a4abf3504df337269f723aae4 --- /dev/null +++ b/log.txt @@ -0,0 +1,17 @@ +================================================================================== + Inicio da execucao: programa que implementa as especificacoes do trabalho 2. + Cristopher Luis Mattoso, Matheus Horstmann +=================================================================================== +O usuario escolheu um vetor de tamanho 1000 +O usuario escolheu valor maximo que o vetor pode ter, esse valor eh : 10000 +Foi alocado 2 vetores de tamanho 1000 com o valor maximo de 10000, com os numeros sorteados, sendo um deles já ordenado +O usuario escolheu a opcao 1, e foi exibido o menu, onde: + 1 - Mostra o menu +2 - Imprime Vetor de Numeros Aleatorios +3 - Imprime Vetor Ordenado +4 - Joga a Quadra +5 - Faz a jornada dos 10.000 vetores +0 - Sai +O usuario escolheu a opcao 4, e comeca o jogo. + O usuario entrou com os seguintes valores : [100, 200, 300, 400] +Sucesso! Os numero inseridos estao contidos no vetor: [1572100480 32767 1 0]