Différences entre les versions de « Modèle:NumCode »
De Wikip
m (1 version importée)  | 
				toross>WikiAdmin   | 
				||
| Ligne 1 : | Ligne 1 : | ||
<includeonly>{| style='font-size:medium;border:0px;margin-top:0.5em;margin-bottom:0.5em  | <includeonly>{| style='font-size:medium;border:0px;margin-top:0.5em;margin-bottom:0.5em;'    | ||
|-       | |-       | ||
|style='vertical-align:top; padding:0em;margin:0em;padding-top:{{{padding|0.2em}}};padding-bottom:{{{padding|0.2em}}};'|<span style='font-size:x-small  | |style='vertical-align:top; padding:0em;margin:0em;padding-top:{{{padding|0.2em}}};padding-bottom:{{{padding|0.2em}}};'|<span style='font-size:x-small;margin-left:0em;padding-left:0.5em;margin-right:0.0em;padding-right:0.5em;margin-bottom:0em;padding-bottom:0.1em;'>{{AtCount|name=src_count|prefix=src |id={{{id|}}}}}</span>    | ||
|style='width:100%  | |style='width:100%;padding:{{{padding|0.2em}}};margin:0.0em;'|  | ||
{{atIfNotNul|1={{{title|}}}|2=<div style='font-size:medium;padding:0em;margin-left:0em;margin-right:0em;margin-top:0em;margin-bottom:0.5em;'>{{m|{{{title}}}|#C0C0FF}}</div>|3=}}  | {{atIfNotNul|1={{{title|}}}|2=<div style='font-size:medium;padding:0em;margin-left:0em;margin-right:0em;margin-top:0em;margin-bottom:0.5em;'>{{m|{{{title}}}|#C0C0FF}}</div>|3=}}  | ||
<div style="border:2px #C0C0FF solid;padding:0.2em;margin:0em;">{{#tag:syntaxhighlight|{{{code|}}}|lang={{{lang|text}}} }}</div>  | <div style="border:2px #C0C0FF solid;padding:0.2em;margin:0em;">{{#tag:syntaxhighlight|{{{code|}}}|lang={{{lang|text}}} }}</div>  | ||
Version du 25 octobre 2023 à 15:26
Version : 1.36.1 4637 (2023-10-25) 20231025152648  
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));
    }
 |