Skip to content
HE-ArcPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

49 Commits

Folders and files

Repository files navigation

ARGOS

ARGOS is a bank of C programming exercises with automated tests. You work on the exercises locally, and the argos CLI compiles your code, runs the tests and shows your progress on a dashboard.

Prerequisites

gcc (with g++) is already installed on your machine. To check your exercises, the argos CLI also needs:

Install both and make sure they are on your PATH. Check with:

cmake --version
ninja --version

The first argos.exe check downloads GoogleTest, so you need an internet connection the first time.

Python is optional on Windows: it is only needed to run argos.py instead of argos.exe. On Linux/macOS, you need Python ≥ 3.12.

Getting started

  1. Fork the original HE-Arc/ARGOS repository (Fork button at the top of its page) — every student works on their own fork, named <your-login>/ARGOS.

  2. Clone your fork:

    git clone https://github.com/<your-login>/ARGOS.git
    cd ARGOS
  3. Activate your learning path (your teacher gives you its id):

    ./argos.exe learning-path add <learning-path-id>

    This copies the exercises of the learning path into the Exercises/ folder — that is where you work.

    Example, for the HE-Arc 1242.1 C course:

    ./argos.exe learning-path add HE-Arc_1242.1_C

Doing an exercise

  1. Pick an exercise from the catalogue below and read its statement (the README.fr.md / README.en.md files linked in the table).

  2. Edit the exercise source in Exercises/ex_NNNN_Name/ — each exercise tells you which function to write. The main.c next to it is a free sandbox: use it to call your function and test it by hand.

    Example, for exercise 0001: write the body of ex_0001_PrintHelloWorld in Exercises/ex_0001_PrintHelloWorld/ex_0001_PrintHelloWorld.c.

  3. Compile by hand, from the exercise folder, with the course command:

    cd Exercises/ex_NNNN_Name
    gcc -Wall -Wextra -Wpedantic -Werror -std=c23 -o main.exe main.c ex_NNNN_Name.c

    Fix every error and warning until it compiles, then run your program:

    ./main.exe

    Try several inputs and compare with what the statement expects.

    Example, for exercise 0001:

    cd Exercises/ex_0001_PrintHelloWorld
    gcc -Wall -Wextra -Wpedantic -Werror -std=c23 -o main.exe main.c ex_0001_PrintHelloWorld.c
    ./main.exe

    The program prints hello, world.

  4. Only once your code compiles and you have tested it, check your solution from the project root. On Windows:

    ./argos.exe check <exercise-id>

    On Linux/macOS (Python ≥ 3.12):

    python argos.py check <exercise-id>

    Example, for exercise 0001 (back at the project root):

    cd ../..
    ./argos.exe check 0001

    Without an id, check runs every exercise of your selected learning paths. Each exercise earns points based on its difficulty (easy = 1, medium = 2, hard = 5); a series is completed when you reach its points target — you do not need to solve every exercise.

When your teacher updates the exercises, pull the changes from the original HE-Arc/ARGOS repository into your fork, then run .\argos.exe sync (a git pull also triggers it automatically).

Reading from stdin

When a statement asks you to flush stdin after a scanf, read and discard every character left on the line, up to and including the newline \n, or until EOF if the input ends first. Combined with input error handling (ask again until the expected values are read), it looks like this:

int status = 0;
const int nbExpectedValues = 1;
int x = 0;
do
{
  printf("Please enter an integer: ");
  status = scanf("%d", &x);

  {
    int c;
    do
    {
      c = getchar();
    } while (c != '\n' && c != EOF);
  }
} while (status != nbExpectedValues && status != EOF);
  • c must be an int, not a char: otherwise the comparison with EOF may never be true.
  • status != EOF covers a rare case: the input is over, not just empty. On an empty keyboard input, scanf waits for the user. But once the input has ended (the user typed Ctrl+Z then Enter on Windows, Ctrl+D on Linux/macOS, or the input comes from a file that has been read to the end, as in the tests), scanf returns EOF at once, every time. Without this check, the loop would print the prompt forever. When the loop stops on EOF, x was not read.
  • Do not use fflush(stdin): fflush is defined for output streams only, its behaviour on stdin depends on the platform.

Without this flush, what scanf left behind (the \n, or a token it could not convert) is read again by the next read: the tests then fail, or never end.

Dashboard

Every check updates your dashboard, a local web page showing your total progression and your points per series. Its path is printed at the end of check (ctrl+click to open it):

Dashboard (ctrl+click to open): <project>\.argos\dashboards\student\index.html

Keep it open while you work: it refreshes by itself after each check.

Student dashboard

Exercises

ID Exercise Tested skills Difficulty
0001 Print Hello World · fr basics 🟢 easy
0002 Print Math Calc · fr arithmetic operators 🟢 easy
0003 Some Calculus · fr arithmetic operators, variables and types 🟢 easy
0004 Swap · fr variables and types 🟢 easy
0005 Celsius to Fahrenheit · fr arithmetic operators 🟢 easy
0006 Asset Interest Rate · fr arithmetic operators, variables and types 🟡 medium
0007 Printf · fr formatted input/output 🟢 easy
0008 Scanf Printf · fr formatted input/output 🟢 easy
0009 Circle · fr formatted input/output 🟡 medium
0010 Lowercase Uppercase · fr conditionals (if / switch) 🟡 medium
0011 Multiplication Sign · fr conditionals (if / switch) 🟡 medium
0012 Decreasing Output · fr conditionals (if / switch) 🟢 easy
0013 Second Order Equation · fr conditionals (if / switch) 🟡 medium
0014 Currency Converter · fr conditionals (if / switch) 🟡 medium
0015 Days In Month · fr conditionals (if / switch) 🟡 medium
0016 Sum Product Mean · fr for loop, formatted input/output 🔴 hard
0017 Factorial · fr for loop 🟢 easy
0018 Squares · fr for loop, functions (pass by value) 🟢 easy
0019 Multiplication Table · fr for loop, functions (pass by value) 🟢 easy
0020 Calculator · fr conditionals (if / switch), functions (pass by value) 🟡 medium
0021 Sum N · fr for loop, functions (pass by value) 🟢 easy
0022 Invert · fr while loop, functions (pass by value) 🟡 medium
0023 Compare Array · fr 1D arrays 🟢 easy
0024 Print Array · fr 1D arrays 🟢 easy
0025 Fill Array · fr 1D arrays, formatted input/output 🟢 easy
0026 Array Sum · fr 1D arrays, for loop 🟢 easy
0027 Array 2D Sum · fr 2D arrays / matrices, formatted input/output 🔴 hard
0028 Dot Product · fr 1D arrays 🟢 easy
0029 Time · fr structures (struct), functions (pass by value) 🟡 medium
0030 Complex · fr structures (struct), functions (pass by value) 🔴 hard
0031 Person · fr arrays of structures, strings 🟡 medium

License

ARGOS — the CLI, tests, exercise statements and skeletons — is released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages