Skip to content

Commit b1b27ad

Browse files
committed
first commit
1 parent ede29b2 commit b1b27ad

File tree

4 files changed

+122
-0
lines changed

4 files changed

+122
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 4
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
end_of_line = lf
12+
13+
[*.md]
14+
trim_trailing_whitespace = false
15+
16+
[Makefile]
17+
indent_style = tab
18+
trim_trailing_whitespace = false

.gitignore

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#===============================
2+
# FOLDERS
3+
#===============================
4+
build/
5+
6+
#===============================
7+
# VS CODE
8+
#===============================
9+
.vscode
10+
*.code-workspace
11+
.history
12+
13+
#===============================
14+
# C/C++
15+
#===============================
16+
# Prerequisites
17+
*.d
18+
19+
# Compiled Object files
20+
*.slo
21+
*.lo
22+
*.o
23+
*.obj
24+
*.ko
25+
*.elf
26+
27+
# Precompiled Headers
28+
*.gch
29+
*.pch
30+
31+
# Compiled Dynamic libraries
32+
*.so
33+
*.dylib
34+
*.dll
35+
36+
# Fortran module files
37+
*.mod
38+
*.smod
39+
40+
# Compiled Static libraries
41+
*.lai
42+
*.la
43+
*.a
44+
*.lib
45+
46+
# Executables
47+
*.i*86
48+
*.x86_64
49+
*.hex
50+
*.app
51+
*.stackdump
52+
*.exe
53+
*.out
54+
55+
# Linker output
56+
*.ilk
57+
*.map
58+
*.exp
59+
60+
# Debug files
61+
*.dSYM/
62+
*.su
63+
*.idb
64+
*.pdb

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
This is my study repository.
44

55
## Repository contents
6+
7+
- Simple Search Algorithm

src/simple_search.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include <iostream>
2+
#include <algorithm> // Para std::find
3+
4+
void imprimeVetor(const int *vetor, int tamanho);
5+
6+
int main()
7+
{
8+
int vetor[10]{1, 45, 65, 22, 55, 76, 81, 89, 96, 99};
9+
int valorProcurado;
10+
11+
imprimeVetor(vetor, 10);
12+
13+
std::cout << "Digite o número que deseja encontrar: ";
14+
std::cin >> valorProcurado;
15+
16+
auto it = std::find(vetor, vetor + 10, valorProcurado);
17+
18+
if (it != vetor + 10)
19+
{
20+
std::cout << "O valor foi encontrado na posição: " << (it - vetor) << std::endl;
21+
}
22+
else
23+
{
24+
std::cout << "O valor não foi encontrado no vetor.\n";
25+
}
26+
27+
return 0;
28+
}
29+
30+
void imprimeVetor(const int *vetor, int tamanho)
31+
{
32+
std::cout << "Vetor: ";
33+
for (auto i = 0; i < tamanho; i++)
34+
{
35+
std::cout << vetor[i] << " - ";
36+
}
37+
std::cout << std::endl;
38+
}

0 commit comments

Comments
 (0)