Skip to content

Instantly share code, notes, and snippets.

View zxmarcos's full-sized avatar

Marcos Medeiros zxmarcos

View GitHub Profile
#include <iostream>
using namespace std;
class Numero {
int val;
public:
Numero(int n = 0) : val(n) {}
~Numero() {}
const Numero operator+(int n) {
return Numero(val);
#include <iostream>
using namespace std;
class Numero {
int val;
int soma;
public:
Numero(int n = 0, int sum = 0) : val(n), soma(sum) {}
~Numero() {}
// Cria um novo valor somado, mas com o campo soma nos dizendo
#include <iostream>
#include <string>
using namespace std;
int subseq(std::string str, std::string pattern)
{
size_t lastpos = 0;
size_t occur = 0;
if (!str.size() || !pattern.size()) {
@zxmarcos
zxmarcos / filacircular.cpp
Created October 17, 2012 20:45
fila circular
#include <iostream>
using namespace std;
#define MAX 5
int queue[MAX];
int init = 0;
int final = 0;
int counter = 0;
@zxmarcos
zxmarcos / date.cpp
Last active December 11, 2015 20:48
// ===========================================================================
// Manipulação algébrica de datas
// Marcos Medeiros
// ===========================================================================
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstring>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LOGIN_MAX 64
#define SENHA_MAX 32
struct usuario_t {
char login[64];
char senha[32];
/* Avaliador de expressões lógicas
*
* Operadores:
* ¬ = ! (negação)
* /\ = ^ (e)
* \/ = | (ou)
* -> = > (condicional)
* <-> = - (bicondicional)
*
* O fluxo das operações dentro do programa é:
#include <iostream>
#include <string>
using namespace std;
class hello {
public:
hello& message(string msg) {
cout << msg;
return *this;
function inserir(t, index, str) {
return t.substring(0, index) + str + t.substring(index, index + t.length);
}
function trocar(t, index, str) {
return t.substr(0, index) + str + t.substr(index+str.length);
}
function validarHora(evt, controle) {
var evento = evt || window.event;
var tecla = evento.keyCode || evento.which;
#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) {