Différences entre les versions de « Modèle:NumCode »
De Wikip
m (1 version importée)  | 
				|||
| (10 versions intermédiaires par 4 utilisateurs non affichées) | |||
| 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=}}  | ||
<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>  | ||
|}</includeonly><noinclude>    | |}</includeonly><noinclude>    | ||
| Ligne 12 : | Ligne 12 : | ||
|syntaxe=<nowiki>{{NumCode|lang=|code=|id=|title=}}</nowiki>    | |syntaxe=<nowiki>{{NumCode|lang=|code=|id=|title=}}</nowiki>    | ||
|specification=      | |specification=      | ||
;lang=    | ;lang=    | ||
:c++ php …     | :c++ php …     | ||
;code=  | ;code=    | ||
: le code    | : le code    | ||
;id=    | ;id=    | ||
Version actuelle datée du 7 février 2024 à 16:15
Version : 1.36.1 4638 (2024-02-7) 20240207161539  
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));
    }
 |