Skip to content

Instantly share code, notes, and snippets.

@juanfal
juanfal / p702.tokens.cpp.cpp
Last active November 24, 2023 13:36
list of words
// p7e02.words.cpp
// juanfc 2023-11-24
// https://gist.github.com/juanfal/f13931517b6599093996884314d010cc
#include <iostream>
#include <array>
using namespace std;
const int N = 100;
typedef array<string,N> TListWords;
@juanfal
juanfal / p7e05.complexnumbers.cpp
Last active November 24, 2023 13:30
complex numbers operations
// p7e05.complexnumbers.cpp
// juanfc 2023-11-24
//
#include <iostream>
using namespace std;
struct TComplex {
float r, i;
};
@juanfal
juanfal / p7e04.wordPos.cpp
Last active November 24, 2023 13:29
word Positions
// p7e04.wordPos.cpp
// juanfc 2023-11-24
//
#include <iostream>
#include <array>
using namespace std;
const int MAX_DIFF_WORDS = 10;
struct TWord {
@juanfal
juanfal / p7e01.freqsArrNums.cpp
Last active November 24, 2023 12:57
freqs of numbers in array
// p7e01.freqsArrNums.cpp
// juanfc 2023-11-24
// https://gist.github.com/2efc0fccebc9a1a87dcb6bff50e16c24
#include <iostream>
#include <array>
using namespace std;
const int N = 10;
const int NINT = 6;
@juanfal
juanfal / p7e03.polynomialsderivative.cpp
Last active November 24, 2023 12:37
polynomial derivative
// p7e03.polynomialsderivative.cpp
// juanfc 2023-11-24
//
#include <iostream>
#include <array>
using namespace std;
const int MAXNMON = 10;
struct TMono {
float coef;
@juanfal
juanfal / t13e19.distancewords.cpp
Last active November 23, 2023 10:14
distance between repeated words
// t13e19.distancewords.cpp
// juanfc 2023-11-23
// https://gist.github.com/juanfal/fb58e2e244b498d11ddee5df47fef9d8
#include <iostream>
#include <array>
using namespace std;
const int MAX_DIFF_WORDS = 100;
@juanfal
juanfal / t13e18.4inrow.cpp
Created November 23, 2023 10:11
4 in a row
// t13e18.4inrow.cpp
// juanfc 2023-11-09
//
#include <iostream>
#include <array>
using namespace std;
const int COLS = 7;
const int ROWS = 6;
@juanfal
juanfal / t13e17.highestMean.cpp
Last active November 23, 2023 10:10
average of M largest numbers
// t13e17.highestMean.cpp
// juanfc 2023-11-23
#include <iostream>
#include <array>
using namespace std;
// consts
const int MAX = 10;
@juanfal
juanfal / t13e15.knightTourCheck.cpp
Last active November 23, 2023 10:05
Knight tour checking
// t13e15.knightTourCheck.cpp
// juanfc 2023-11-23
//
#include <iostream>
#include <array>
using namespace std;
const int N = 8;
typedef array<array<int,N>,N> TChessboard;
@juanfal
juanfal / t13e14.coxeter.cpp
Last active November 23, 2023 10:03
Coxeter formula to build Magic Squares (odd sizes)
// t13e14.coxeter.cpp
// juanfc 2023-11-23
//
//
#include <iostream>
#include <array>
#include <iomanip>
using namespace std;