Programmation

C++ intermédiaire

RAII, pointeurs intelligents, STL, exceptions, CMake et fichiers — le C++ qu’on maintient, pas un main.cpp de 400 lignes.

  1. 01Leçon

    Une introduction, puis des exemples à taper.

  2. 02Exercices

    Écrire soi-même, avec un critère de réussite.

  3. 03Quiz

    Cinq questions. Toutes justes pour valider.

À propos

Introduction

Vous compilez un main, des vector, des string. Ici : ressources, algorithmes, erreurs, build CMake, I/O fichiers. Amina n’écrit plus de new nu.

Neuf modules, comme Python intermédiaire. Définition, exemple, sortie, pièges. Atelier programme complet, TD, QCM.

Prérequis : cours C++ débutant. C++17, CMake 3.16+.

Objectifs

  • RAII, unique_ptr / shared_ptr
  • algorithm, optional
  • exceptions vs codes
  • CMake + ctest
  • ifstream / filesystem
  • Templates, std::thread, chrono, CLI argc/argv

Programme

9 modules · 45 leçons

  1. 01

    RAII et pointeurs

    Chaque ressource a un destructeur.

    • RAII, pas de new nuLeçon · 85 min
    • unique_ptr et shared_ptrLeçon · 80 min
    • Atelier : make_unique vectorLeçon · 55 min
    • TD : unique_ptr NotesExercice · 40 min
    • QCM : RAIIQuiz · 12 min
  2. 02

    STL algorithms

    Exprimer le métier sans for bruts partout.

    • sort, find_if, accumulateLeçon · 80 min
    • optional et structured bindingsLeçon · 80 min
    • Atelier : count_if admisLeçon · 55 min
    • TD : admisExercice · 40 min
    • QCM : STLQuiz · 12 min
  3. 03

    Exceptions

    Une stratégie d’erreur, pas un mélange.

    • throw, catch, noexceptLeçon · 80 min
    • RAII + exceptionsLeçon · 75 min
    • Atelier : main catchLeçon · 55 min
    • TD : moyenne videExercice · 40 min
    • QCM : exceptionsQuiz · 12 min
  4. 04

    CMake et tests

    Le build reproductible.

    • CMakeLists bibliothèqueLeçon · 80 min
    • ctest, assertLeçon · 75 min
    • Atelier : lib + exeLeçon · 55 min
    • TD : lib notesExercice · 40 min
    • QCM : CMakeQuiz · 12 min
  5. 05

    Fichiers

    <filesystem> et flux.

    • ifstream ofstreamLeçon · 80 min
    • filesystem pathLeçon · 75 min
    • Atelier : lire notes.txtLeçon · 55 min
    • TD : notes.txtExercice · 40 min
    • QCM : I/OQuiz · 12 min
  6. 06

    Templates

    Une fonction pour int et double.

    • function templateLeçon · 80 min
    • pourquoi pas void*Leçon · 75 min
    • Atelier : max_noteLeçon · 55 min
    • TD : max de deux notesExercice · 40 min
    • QCM : templatesQuiz · 12 min
  7. 07

    Threads

    std::thread, join, pas de data race.

    • thread et joinLeçon · 80 min
    • mutex lock_guardLeçon · 75 min
    • Atelier : joinLeçon · 55 min
    • TD : deux moyennesExercice · 40 min
    • QCM : threads C++Quiz · 12 min
  8. 08

    Temps

    steady_clock pour mesurer, pas system_clock.

    • steady_clockLeçon · 80 min
    • sleep_forLeçon · 75 min
    • Atelier : ms d’une moyenneLeçon · 55 min
    • TD : chronométrer moyenneExercice · 40 min
    • QCM : chronoQuiz · 12 min
  9. 09

    CLI C++

    argc argv, codes de sortie.

    • argvLeçon · 80 min
    • stoi et exceptionsLeçon · 75 min
    • Atelier : afficher argvLeçon · 55 min
    • TD : --seuilExercice · 40 min
    • QCM : CLI C++Quiz · 12 min