NumCode

De Paint
Révision datée du 25 octobre 2023 à 16:26 par toross>WikiAdmin
Version : 1.36.1 2916 (2023-10-25) 20231025162648
Résumé :
Ce modèle sert présenter un code programmation.

{{NumCode|lang=|code=|id=|title=}}

lang=
c++ php …
code=
le code
id=
id unique
title=
titre

Exemple :

{{NumCode|lang=cpp|id=c1|title=Mon code|code=
    #include <time.h>
    #include <stdio.h>
    void sleep( time_t nb_sec  )
    {
        time_t limit, top;
        time(&top);
        limit = top + nb_sec ;
        while (top < limit)
        {
            time(&top);
        }
    };
    int main( int argc, char * argv[] )
    {
        time_t start, stop; 
        time(&start);
        sleep( 5  ) ;
        time(&stop);
        printf("start : %ld\n",start );
        printf("stop  : %ld\n",stop );
        printf("in seconds: %f\n",difftime(stop,start));
    }
}}

donnera :

src 1
Mon code
#include <time.h>
    #include <stdio.h>
    void sleep( time_t nb_sec  )
    {
        time_t limit, top;
        time(&top);
        limit = top + nb_sec ;
        while (top < limit)
        {
            time(&top);
        }
    };
    int main( int argc, char * argv[] )
    {
        time_t start, stop;
        time(&start);
        sleep( 5  ) ;
        time(&stop);
        printf("start : %ld\n",start );
        printf("stop  : %ld\n",stop );
        printf("in seconds: %f\n",difftime(stop,start));
    }