Différences entre les versions de « Modèle:NumCode »
De Wikip
m (1 révision importée)  | 
				|||
| Ligne 9 : | Ligne 9 : | ||
||class=§  | ||class=§  | ||
|texte=Ce modèle sert présenter un code programmation.       | |texte=Ce modèle sert présenter un code programmation.       | ||
|auteurs=  | |auteurs=    | ||
|syntaxe=<nowiki>{{NumCode|lang=|code=|id=|title=}}</nowiki>    | |syntaxe=<nowiki>{{NumCode|lang=|code=|id=|title=}}</nowiki>    | ||
|specification=      | |specification=      | ||
Version du 14 janvier 2019 à 20:43
Version : 1.36.1 2448 (2019-01-14) 20190114204341  
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 | 
 <atif a="<div style='font-size:medium;padding:0em;margin-left:0em;margin-right:0em;margin-top:0em;margin-bottom:0.5em;'><span style="border-color:#606060;border-radius:0.4em;border-style:solid;border-width:1pt;min-height:1em;padding-left:0.5em;padding-right:0.5em;background:#C0C0FF;color:#FFFFFF;">Mon code</span></div>" b=""> Mon code </atif> #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));
    }
 |