Camille
# Type your text here # @file SmashOrPass.c # @brief Smash or pass # @author Fujima Electronics # @copyright Copyright (c) 2025 Fujima Electronics. All rights reserved. # @version 1.0 # @date September 24, 2025 # # Smash or pass. # # @todo Find a way to print non-ASCII characters because # Windows sucks at this. # # @license Copyright (c) 2025 Fujima Electronics. All rights reserved. # You are not allowed to reuse the content of this file outside of # an educational purpose. In this case, the following limitations # must be applied : # - The source code of the derived sotware must be released along with the binaries and # the documentation, if existing. # - The derived software cannot be sold or exchanged with money. This apply to both the # binaries and the source. # - The derived software must contain this notice (including the copyright). This apply # to the binaries, the source, and the documentation, if existing. # - The derived software must be released under the terms of this license, or any licence # compatible with this one. # Any use of this code outside the terms of this license must be explicitly allowed by # Fujima Electronics. #include <stdio.h> #include <string.h> #include <stdint.h> #include <stdbool.h> # # @def NAME_MAX_SIZE # Max lenght for the name (NULL byte counted) # #define NAME_MAX_SIZE 32 bool GetInputStr(char *string, size_t max); bool ProcessName(int8_t *name, size_t max); int main(void) { char name[NAME_MAX_SIZE]; bool smash = false; printf("Smash Or Pass\nCopyright (c) 2025 Fujima Electronics\n"); printf("Note : n'oubliez pas les majuscules, les accents et les tirets pour les prenoms composes !\n\n"); while(true) { printf("Entrez un prenom : "); if (GetInputStr(name, NAME_MAX_SIZE)) { //Cast to a fixed-size integer array because char is not guaranteed to be 8 bits wide smash = ProcessName((int8_t *)name, NAME_MAX_SIZE); printf("%s est un ", name); if (smash) { printf("smash !\n\n"); } else { printf("pass !\n\n"); } } else { printf("Error : GetInputStr returned \'false\' !\n"); } } return 0; } # @fn bool GetInputStr(char *string, size_t max) # @brief Get user input, with spaces. # # @param string Buffer to store the input (must be big enough) # @param max Max input size # # @retval true Success # @retval false scanf() failed #/ bool GetInputStr(char *string, size_t max) { size_t i; for (i = 0; i < max - 1; ++i) ... (108lignes restantes)