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
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
using namespace std; | |
int main() { | |
vector<string> vet {"hello", "world", "take", "the", "moon"}; | |
vector<string>::iterator it; |
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
/* | |
See StackOverflow | |
http://stackoverflow.com/questions/21137812/check-to-see-if-integer-is-one-in-which-each-digit-is-either-a-zero-or-a-one | |
to know why this exists. Do not take it seriously: the other answers show the way! | |
*/ | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <inttypes.h> | |
#include <limits.h> |
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
/* | |
bison test 1 (single file), | |
widely based on examples in the bison manual at | |
http://www.gnu.org/software/bison/manual/ | |
It should compile with | |
$ bison mcalcpp.yy | |
$ g++ mcalcpp.tab.cc | |
or alike. (bison v>3.0; any C++98 compiler should go) | |
*/ |
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
incdir "include:" | |
include "exec/exec.i" | |
include "exec/exec_lib.i" | |
include "dos/dos_lib.i" | |
opt p=68020 | |
_start |
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
extern printf | |
extern getchar | |
extern isalpha | |
section .data | |
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
package main | |
import ( | |
io "bufio" | |
"fmt" | |
"os" | |
"sync" | |
"unicode" | |
) |
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
package main | |
import ( | |
io "bufio" | |
"fmt" | |
"os" | |
"unicode" | |
) | |
type ControlFlow struct { |
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
% gprolog: nth | |
% swi prolog: nth0 | |
vicino(List, A, B) :- | |
nth(IndexA, List, A), | |
nth(IndexB, List, B), | |
abs(IndexA - IndexB) =:= 1. | |
chi(Luca, Aldo, Berto) :- | |
vicino([4, 0, 2, 1, 3], Luca, Aldo), | |
vicino([1, 2, 3, 0, 4], Berto, Aldo), |
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
{- | |
This code answers to "Un quesito con la Susi n. 923" | |
(a puzzle on an italian magazine). | |
Brute force, no optimization (and no Haskell guru here). | |
-} | |
import Data.List | |
checkSol :: [Int] -> Bool | |
checkSol a = | |
5*susi == gianni && (sum a) == (susi + gianni + tavolo) |
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
#include <stdio.h> | |
typedef struct { | |
double x; | |
double y; | |
} vec2d; | |
#define sum(X, Y) _Generic((X), \ | |
int: sum2l((X), (Y)), \ | |
long: sum2l((X), (Y)), \ |