Skip to content

Instantly share code, notes, and snippets.

@juanfal
juanfal / sanatorio.cpp
Created September 8, 2014 00:00
sanatorio.cpp
// sanatorio.cpp
// juanfc 2014-06-19
// Examen FP-IS-sep2014
#include <iostream>
#include <fstream>
using namespace std;
// 9 Manolo
@juanfal
juanfal / sanatorio.cpp
Created September 8, 2014 00:05
Respuesta al ex FP IS sep 2014
// sanatorio.cpp
// juanfc 2014-06-19
// Examen FP-IS-sep2014
// https://gist.github.com/3fbf699dd2e88dec7964
#include <iostream>
#include <fstream>
using namespace std;
@juanfal
juanfal / distancias.cpp
Created October 19, 2014 15:28
cálculo de la distancia de un punto (xp,yp) a un segmento (no recta), (x1,y1)-(x2,y2) de pendiente 1. Es muy preciso, da resultado real. Falta simplificar-optimizar y considerar el caso de pendiente -1
// distPsegm.cpp
// juanfc 2014-10-19
// Distancia de un punto (xp, yp) a una recta de pendiente 1
// El resultado se da como número real. Si se quiere pasar a entero
// sumarle antes 0.5
// Es demasiado preciso, ahora vendría la optimización para evitar
// las lentas sqrt(), para lo que se necesita no se requiere
// tanta precisión
//
// Falta el otro caso, de pendiente -1. Habría que poner una condición
@juanfal
juanfal / menu.cpp
Created October 27, 2014 08:37
menu
// menu.cpp
// juanfc
//
#include <iostream>
using namespace std;
// prototipos
int menu();
// principal
@juanfal
juanfal / 02.primos.cpp
Created November 4, 2014 07:52
Comprobación de si un número dado es primo mediante prueba directa, dividiendo por todos los candidatos
// primos.cpp
// juanfc 2014-11-04
// Comprobación de si un número dado es primo mediante
// prueba directa, dividiendo por todos los candidatos
#include <iostream>
using namespace std;
int main()
{
@juanfal
juanfal / frecpals.cpp
Created January 15, 2015 08:50
// a) Añade las palabras a un diccionario, con frecuencias b) Añade ordenadamente las palabras a un diccionario, con frecuencias
// frecpals.cpp
// juanfc 2015-01-15
// a) Añade las palabras a un diccionario,
// con frecuencias
// b) Añade ordenadamente las palabras a un
// diccionario, con frecuencias
//
// 0 1 2 3 NMAXPAL-1
// +------+------+------+------+- -+------+------+------+------+
// | pal | pal | pal | pal | // | pal | pal | pal | pal |
@juanfal
juanfal / unaseq.fasta
Created January 20, 2015 19:06
Una secuencia fasta simple de ejemplo
>gi|5524211|gb|AAD44166.1| cytochrome b [Elephas maximus maximus]
catctagtgtcgtcatgtcaggaggcaactgagccttatcatcctcctggagcgcacctttcttacctggcgcggatctt
actctcaccttatcctcttggtatatgatgccaagtgccatgagtcactgaattgcaagtgcccggttccatttttttac
taactcttctggttttttgatctcactttcttcccagggtcgctttcccgacactcccccacccctattgtcactacccc
aaaatattgttagggaccgaccagataaccagccaaaaagggctatgaaagcactactcaagtgctggaacccgggaagt
tgcaaacgcacctgactcgcgtttttccaaccaatatggtacgatgaaatagtagatccactcagctcatgagtagagta
gaggaacctgacaaagcggactcgcgtggcctagtcataagaaagtgctatacagctccagatgcgagctaccagtaacg
cggaccttcttcaacactctcaacccttcgtacaggggccggggcagcacatttagcactcaccctaagaagtaatgcaa
cacc
@juanfal
juanfal / freqs.cpp
Created February 1, 2015 23:39
trying to solve a problem
// Make a subprogram void freqNumbers(int freqs[], int min, int max)to read
// numbers between min and max, until a number out of this range is entered.
// Then, the subprogram must return the frequencies of every number, and then
// in the main() print on the screen every number with its frequency. Try it
// with 0 and 9 for min and max. For example:
// Input: 1 8 7 3 4 8 5 9 5 0 0 4 8 4 5 3 2 8 -1
// Output: 0:2; 1:1; 2:1; 3:2; 4:3; 5:3; 6:0; 7:1; 8:4; 9:1
@juanfal
juanfal / easterday.cpp
Created March 17, 2015 11:08
Cpp procedure that computes the Easter Day (Domingo de Ramos) month, day for a given year
// easterday.cpp
// juanfc 2015-03-17
//
// In our Gregorian calendar, The Easter Day (Domingo de Ramos):
// The Sunday following the full Moon which falls on or after the equinox will
// give the lawful Easter
// Astronomical Easter is the first Sunday after the Astronomical full
// moon, referred to the meridian of Jerusalem.
//
#include <iostream>
@juanfal
juanfal / gist:6d2baa88e31ea9f0a0c1
Created July 6, 2015 10:19
final errors in Codeblock compiling… Codeblock 10350-trunk on OSX 10.10
In file included from debuggergdb.cpp:10:
In file included from ../../../src/include/sdk.h:17:
In file included from ../../../src/include/sdk_precomp.h:13:
In file included from ../../../src/include/sdk_common.h:150:
In file included from ../../../src/include/filemanager.h:13:
../../../src/include/backgroundthread.h:143:13: warning: 'this' pointer cannot be null in well-defined C++ code; pointer may be assumed to always convert
to true [-Wundefined-bool-conversion]
if (this && IsRunning())
^~~~ ~~
In file included from debuggergdb.cpp:10: