Skip to content
Snippets Groups Projects
Commit 6a97b319 authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

Deixando Mais Legivel

parent 894c0015
No related branches found
No related tags found
No related merge requests found
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/time.h> #include <sys/time.h>
#define TAM 10 //tamanho do vetor #define TAM 20 //tamanho do vetor
#define NUMMAX 5 //constante que tem o máximo de valores #define NUMMAX 50 //constante que tem o máximo de valores
No preview for this file type
...@@ -5,11 +5,12 @@ ...@@ -5,11 +5,12 @@
int main () { int main () {
int Vetor[TAM], Escolhidos[4]; int Vetor[TAM], Escolhidos[4];
int comando, Ordena; int comando, Ordena;
for (;;) {
printf ("1 - Jogar\n2 - Comparar Algortimos\n"); printf ("1 - Jogar\n2 - Comparar Algortimos\n");
scanf ("%d", &comando); scanf ("%d", &comando);
switch (comando) { switch (comando) {
case 1: case 1:
printf ("Digite 4 Valores de 1 a 50\n");
LerDados (Escolhidos); LerDados (Escolhidos);
GeraVetor (Vetor); GeraVetor (Vetor);
//Sorteia o Algoritmo para Ordenar o Vetor //Sorteia o Algoritmo para Ordenar o Vetor
...@@ -51,3 +52,4 @@ int main () { ...@@ -51,3 +52,4 @@ int main () {
TempoQuickSortIterativo (Vetor); TempoQuickSortIterativo (Vetor);
} }
} }
}
...@@ -15,7 +15,7 @@ void GeraVetor (int *Vetor) { ...@@ -15,7 +15,7 @@ void GeraVetor (int *Vetor) {
srand (time(NULL)); srand (time(NULL));
for (i=0; i < TAM; i++) for (i=0; i < TAM; i++)
Vetor[i] = rand () % NUMMAX; Vetor[i] = (rand () % NUMMAX) + 1;
} }
//Função que imprime o vetor //Função que imprime o vetor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment