Blog post cover

2019-02-25 23:47 - Technical

C++ in French with french-cpp

You’ve always wanted to program in French? Now it is possible in C++ thanks to my header-only library french-cpp. How simple it has become to program with the most beautiful language in the world (French I mean, not C++) :)

The project is available on GitHub, with more details on how to use it: https://github.com/Nyrio/french-cpp

Example of use

#include "frenc.h"

#include <cmath>
#include <iostream>

utilisons espacedenoms std;

booleen est_premier(entier n) {
    entier facto = 0;
    si(n <= 1)
        retourner faux;
    pour(positif entier i = 2; exposant(i, 2) <= n; i++) {
        si(n modulo i == 0)
            retourner faux;
    }
    retourner vrai;
}

entier principal() {
    entier n;
    entree >> n;

    si(est_premier(n))
        sortie << n << " est premier" << findeligne;
    sinon
        sortie << n << " n'est pas premier" << findeligne;
}

Actually…

This project is no more than a joke. It works, though. I had the idea today and I programmed that this evening. Yes I have a weird sense of humor. Don’t judge me!

Log in to post a comment.