Skip to content

Instantly share code, notes, and snippets.

View senapk's full-sized avatar

David Sena Oliveira senapk

  • UFC
  • Fortaleza - CE
View GitHub Profile
@senapk
senapk / bubassauro.pro
Last active August 18, 2016 18:56
Controlando a pokebola
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
LIBS += -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
SOURCES += main.cpp
#include <iostream>
#include <vector>
using namespace std;
string completar(string letra){
return letra + ((letra == "x") ? "z" : "x");
}
vector<string> preparar_texto(string texto){
vector<string> cifrado;
@senapk
senapk / cartas_naipe.cpp
Created June 19, 2017 18:38
Imprimindo os nipes das cartas
#include <iostream>
using namespace std;
const char * COPAS = "\xe2\x99\xa5";
const char * OUROS = "\xe2\x99\xa6";
const char * PAUS = "\xe2\x99\xa3";
const char * ESPADAS = "\xe2\x99\xa0";
int main(){
cout << "Copas " << COPAS << endl;
@senapk
senapk / poo.h
Last active October 21, 2017 19:59
Classes Repositório e Auxiliar para POO EC
#ifndef POO_H
#define POO_H
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
namespace poo {
template <class T>
@senapk
senapk / ts_on_page.ts
Created November 30, 2017 18:27
Modelo para rodar o programa em ts na página
var input = document.createElement("input");
input.setAttribute('type', 'text');
let idiv = document.createElement("div");
idiv.id = 'block';
idiv.className = 'block';
function exec(){
idiv.innerHTML = input.value + "<br/>" + idiv.innerHTML;
input.value = "";
@senapk
senapk / arvore_de_decisao.cpp
Last active December 1, 2017 14:42 — forked from anonymous/arvore_de_decisao.cpp
Arvore de decisão gráfica
#include <iostream>
#include <vector>
using namespace std;
namespace aluno{
struct DcNode{
string key; //resposta
string value;//pergunta ou afirmacao
@senapk
senapk / task.json
Last active June 27, 2018 20:05
Task para rodar c++ no visual studio code utilizando um makefile externo
{
"version": "2.0.0",
"tasks": [
{
"label": "Run tests",
"type": "shell",
"command": "./main",
"windows": {
"command": ".\\scripts\\test.cmd"
@senapk
senapk / quick.c
Last active July 1, 2018 01:10
quicksort compactado em c
#include <stdio.h>
#include <stdlib.h> //rand srand
#include <time.h>//time
#define SWAP(x, y) do { typeof(x) SWAP = x; x = y; y = SWAP; } while (0) //gcc only
void quick(int * vet, int C, int F){
if(C >= F) return;
int i = C, j = F, pivo = vet[(i + j)/2];
while(i <= j){
while (vet[i] < pivo) i++;
@senapk
senapk / Makefile
Last active July 2, 2018 17:53
Create lab in C
all:
gcc -Wall ./create_lab.c -o lab && ./lab 20 80
@senapk
senapk / Makefile
Last active August 19, 2018 17:14
Makefile para rodar testes e gerar vlp.cases
# Para o run passe o nome do comando executável e o nome da pasta que contem os testes
# Ex: O nome do executavel é 'calculadora' e a pasta que contem os testes no formato .in .sol é 'testes'
# make run cmd=calculadora folder=testes
# Para gerar o vpl a usando os testes da pasta 'testes' faça
# make vpl folder=testes
# Se o modelo dos arquivos de entrada e saída forem in1, out1, in2, out2, você deve usar os comandos
# make run2 cmd=executavel folder=testes
# make vpl2 folder=testes