Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CI056 - Trabalho 1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Harbor Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matheus Horstmann
CI056 - Trabalho 1
Commits
a8940cb1
Commit
a8940cb1
authored
9 years ago
by
clm15@inf.ufpr.br
Browse files
Options
Downloads
Patches
Plain Diff
fazendo menu
Signed-off-by:
Cristopher
<
clm15@inf.ufpr.br
>
parent
636615b0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Quadra.c
+50
-4
50 additions, 4 deletions
Quadra.c
with
50 additions
and
4 deletions
Quadra.c
+
50
−
4
View file @
a8940cb1
...
...
@@ -17,7 +17,42 @@ void vetSort(int *vet, int Tam, int max)
vet
[
i
]
=
sorteia
(
1
,
max
);
}
void
vetcpy
(
int
*
vet
,
int
*
vet_ord
,
int
Tam
)
{
int
i
;
vet_ord
=
(
int
*
)
malloc
((
Tam
+
1
)
*
sizeof
(
int
));
for
(
i
=
1
;
i
<=
Tam
;
i
++
)
vet_ord
[
i
]
=
vet
[
i
];
}
void
imprime
(
int
*
vet
,
int
N
)
{
int
i
;
for
(
i
=
1
;
i
<=
N
;
i
++
)
{
if
((
i
%
10
)
==
0
)
printf
(
"
\n\n
"
);
printf
(
"%d "
,
vet
[
i
]);
}
}
void
jogar
(
int
*
vet
,
int
*
vet_ord
,
int
N
)
{
int
x
,
i
=
0
,
j
;
printf
(
"Entre com a Quadra de valores: "
);
for
(
j
=
0
;
j
<
4
;
j
++
)
{
scanf
(
"%d"
,
&
x
);
if
((
pesqseq
(
vet
,
x
,
N
)
!=
0
)
||
(
pesqbin
(
vet_ord
,
x
,
N
)
!=
0
))
i
++
;
}
if
(
i
==
4
)
printf
(
"Sucesso!!
\n
"
);
else
if
(
i
>
0
)
printf
(
"%d valores encontrados!
\n
"
,
i
);
else
printf
(
"Nenhum valor encontrado!
\n
"
);
}
int
main
(
void
)
{
...
...
@@ -28,7 +63,8 @@ int main (void)
printf
(
"Entre com valor maximo dos numeros aleatorios: "
);
scanf
(
"%d"
,
&
max
);
vetSort
(
vet
,
Tam
,
max
);
vetcpy
(
vet
,
vet_ord
,
Tam
);
QuickSort_it
(
vet_ord
,
Tam
);
printf
(
"
\n
Menu:
\n
"
);
menu
=
1
;
while
(
menu
!=
0
)
...
...
@@ -36,9 +72,19 @@ int main (void)
switch
(
menu
)
{
case
1
:
printf
(
"1 - Mostrar menu
\n
2 - Imprimir Vetor de Numeros Aleatorios
\n
3 - Imprimir Vetor Ordenado
\n
4 - Jogar
\n
5 - "
)
printf
(
"1 - Mostrar menu
\n
2 - Imprimir Vetor de Numeros Aleatorios
\n
3 - Imprimir Vetor Ordenado
\n
4 - Jogar
\n
5 - Fazer jornada dos 10.000 vetores
\n
"
);
break
;
case
2
:
imprime
(
vet
,
Tam
);
break
;
case
3
:
imprime
(
vet_ord
,
Tam
);
break
;
case
4
:
jogar
(
vet
,
vet_ord
,
Tam
);
break
;
case
5
:
// jornada! Desenvolver!
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment