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
// t03e06.dogage.cpp | |
// juanfc 2021-10-17 | |
// Write a program to calculate a dog's age in dog's years. | |
// For the first two years, a dog year is equal to 10.5 human years. After that, | |
// each dog year equals 4 human years. For example: | |
// \begin{code} | |
// Input a dog's age in human years: 15 | |
// The dog's age in dog's years is 73 | |
// https://gist.github.com/6fbc2f4c93c4855ae90bf919f135e603 |
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
#!/usr/bin/env ruby -wU | |
# juanfc 2024-03-16 | |
# https://gist.github.com/juanfal/39206b7d47a1eacac35cbd1b98f6f5d3 | |
if ARGV.length < 1 or (ARGV.length == 1 and ARGV[0] == '-h') then | |
puts "Usage: | |
#$0 [destdmg] sourceFolder [sourceFolders..] | |
" | |
exit 0 | |
end |
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
#!/bin/sh | |
# myip | |
# juanfc 2024-01-11 | |
# wget http://ipinfo.io/ip -qO - | |
# ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null | |
# dig +short myip.opendns.com @208.67.222.222 | |
# dig +short myip.opendns.com @resolver1.opendns.com | |
# ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null |
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
// x3.mbiggest.cpp | |
// juanfc 2024-01-08 | |
// Without open array | |
// | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int MAXDIFNUMS = 50; |
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
// x2.maxdistrepwords.cpp | |
// juanfc 2024-01-08 | |
// | |
// The \textbf{distance between two words} in a text is the number of words in | |
// between them. Build an algorithm that reads from keyboard a sequence of words | |
// and then print on the screen the maximum distance between repeated words. | |
// Words that are no repeated will not appear in the output. | |
#include <iostream> |
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
// x1.words.cpp | |
// juanfc 2024-01-08 | |
// | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int MAX_DIFF_WORDS = 1000; | |
const int MAX_REP = 1000; |
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
// t13e18.GameOfLife.cpp | |
// juanfc 2023-12-11 | |
// https://gist.github.com/juanfal/14e0ffcb4439a5544a9c08768b6b3a99 | |
// | |
// Three rules: | |
// INITIAL STATE -> FINAL STATE | |
// dead with 3 -> alive | |
// alive with 2 or 3 -> alive | |
// else -> dead | |
// |
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
// t12e07.polynomials.cpp | |
// juanfc 2023-11-23 | |
// https://gist.github.com/baf068a06eafb1ecba8a584fe375b780 | |
// Elements of the polynomials are kept ordered | |
// from highest to lowest degrees | |
// | |
#include <array> | |
#include <iostream> | |
using namespace std; |
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
// t13e03.identityMat.cpp | |
// juanfc 2023-11-23 | |
// | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int N = 3; | |
typedef array<array<int, N>,N> TSqMat; |
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
// sieveOfRepeated.cpp | |
// juanfc 2023-11-27 | |
// https://gist.github.com/079916adc1420f95017328d1f04797e7 | |
#include <iostream> | |
#include <array> | |
using namespace std; | |
const int MAX = 100; | |
struct TOpenAr { |
NewerOlder