This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define VERMELHO 9 | |
#define AMARELO 10 | |
#define VERDE 11 | |
int numeros[10][7] = | |
{ | |
// A B C D E F G | |
{ 1, 1, 1, 1, 1, 1, 0 }, // Num 0 | |
{ 0, 1, 1, 0, 0, 0, 0 }, // Num 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numero_secreto = 0; | |
int estado = 0; | |
int contador = 0; | |
int botao_anterior = 0; | |
int numeros[10][7] = | |
{ | |
// A B C D E F G | |
{ 1, 1, 1, 1, 1, 1, 0 }, // Num 0 | |
{ 0, 1, 1, 0, 0, 0, 0 }, // Num 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numeros[10][7] = | |
{ | |
// A B C D E F G | |
{ 1, 1, 1, 1, 1, 1, 0 }, // Num 0 | |
{ 0, 1, 1, 0, 0, 0, 0 }, // Num 1 | |
{ 1, 1, 0, 1, 1, 0, 1 }, // Num 2 | |
{ 1, 1, 1, 1, 0, 0, 1 }, // Num 3 | |
{ 0, 1, 1, 0, 0, 1, 1 }, // Num 4 | |
{ 1, 0, 1, 1, 0, 1, 1 }, // Num 5 | |
{ 1, 0, 1, 1, 1, 1, 1 }, // Num 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
using namespace std; | |
template<class T> | |
class binary_tree { | |
struct node { | |
unique_ptr<node> left; | |
unique_ptr<node> right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================================= | |
// Implementação genérica de árvore binária utilizando C++11 | |
// Essa árvore consegue trabalhar com qualquer tipo desde que ele tenha | |
// as funções >, < e == implementadas. O operador de cópia é recomendado. | |
// | |
// Marcos Medeiros, 2014 | |
//============================================================================= | |
#include <iostream> | |
#include <exception> | |
#include <cstdint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//============================================================================= | |
// Resolve o problema do cavalo utilizando backtracking... | |
// | |
// Este código utiliza muitas referências e constantes de maneira | |
// a permitir que ele rode mais rápido possível... | |
// | |
// Versão melhorada (e mais complexa), utilizando multithreading, | |
// o código pode utilizar até 8 threads dependendo da posição inicial dada. | |
// Esse código utiliza o padrão C++11 | |
//============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
select nome, salario, salario * 1.15 as "salário previsto" from professor | |
2) | |
select depto.descricao, cargo.descricao, sum(salario), max(salario), min(salario), avg(salario) from professor | |
join depto on (depto.codigo = professor.depto) | |
join cargo on (cargo.codigo = professor.cargo) | |
group by depto.descricao, cargo.descricao | |
order by depto.descricao, cargo.descricao |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#include <set> | |
using namespace std; | |
struct btree { | |
struct btree *left; | |
struct btree *right; | |
int value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
template <typename Tipo> | |
class Lista { | |
typedef struct No { | |
Tipo data; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
template<typename T> | |
void selection(T &n) | |
{ | |
for (typename T::iterator it = n.begin(); it != n.end()-1; ++it) { |