feat(lvl00/ressources): adding the program to test all rot

This commit is contained in:
Raphael 2026-01-26 15:38:33 +01:00
parent 96360c3373
commit 6d4c37d7aa
No known key found for this signature in database

20
level00/ressources/rotX.c Normal file
View file

@ -0,0 +1,20 @@
#include <stdio.h>
char rotate_char(char c, int rot) {
return (c - 'a' + rot) % 26 + 'a';
}
void rotate_string(const char *input, int rot) {
printf("rot%d:\t", rot);
for (int i = 0; input[i] != '\0'; i++) {
printf("%c", rotate_char(input[i], rot));
}
printf("\n");
}
int main() {
char input[] = "cdiiddwpgswtgt";
for (int rot = 1; rot <= 25; rot++) {
rotate_string(input, rot);
}
}