Différences entre les versions de « Modèle:CodeTr »
De Paint
m (1 version importée) |
|||
(8 versions intermédiaires par 4 utilisateurs non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
<includeonly> | <includeonly>{{#tag:truncHtml| | ||
{{#tag: | {{#tag: source|{{{code|}}} | ||
|lang={{{lang|text}}} | |||
|line={{{line|}} | |||
|start={{{start|}}} | |||
|style=width:{{{width|70}}}ch;{{{style|}}} | |||
}}|width={{{width|70}}} }} | |||
</includeonly> | |||
<noinclude> | |||
{{Model | {{Model | ||
|class=lang | |class=lang | ||
|texte=Ce modèle sert présenter un code programmation. | |texte=Ce modèle sert présenter un code programmation. | ||
|auteurs= | |auteurs= | ||
|syntaxe=<nowiki>{{codeTr|lang=|code=}}</nowiki> | |syntaxe=<nowiki>{{codeTr|lang=|code=}}</nowiki> | ||
|specification= | |specification= | ||
;lang= | ; lang= | ||
:c++ php … | : c++ php … | ||
;code= | ; code= | ||
: le code | : le code (text) | ||
}} | ; line=1 | ||
Exemple : | : | ||
; start=100 | |||
: | |||
; width | |||
: largeur en nombre de caractères, défaut : 70 | |||
; style=border:3px dashed blue; | |||
: | |||
}} | |||
Exemple : | |||
<pre><nowiki>{{parW|{{codeTr|width=75|lang=text|style=border:3px dashed blue;|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345 | |||
# 1 2 3 4 5 6 7 | |||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | |||
}}}} | |||
{{parW|{{codeTr|line=1|Start=100|width=50|lang=text|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789 | |||
# 1 2 3 4 5 6 7 8 | |||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | |||
}}}} | |||
{{parW| | |||
{{codeTr|lang=cpp|start=300|line=1|width=70|style=border:3px dashed red;|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 | |||
# 1 2 3 4 5 6 7 | |||
#include <time.h> | #include <time.h> | ||
#include <stdio.h> | #include <stdio.h> | ||
void sleep( time_t nb_sec | void sleep( time_t nb_sec ) | ||
{ | { | ||
time_t limit, top; time(&top); limit = top + nb_sec ; | time_t limit, top; time(&top); limit = top + nb_sec ; | ||
Ligne 27 : | Ligne 56 : | ||
int main( int argc, char * argv[] ) | 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)); | 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)); | ||
} | } | ||
}} | }} | ||
}}</nowiki> | }}</nowiki></pre> | ||
donnera : | donnera : | ||
{{parW|{{codeTr|width=75|lang=text|style=border:3px dashed blue;|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345 | |||
# 1 2 3 4 5 6 7 | |||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | |||
}}}} | |||
{{parW|{{codeTr|line=1|Start=100|width=50|lang=text|code= | |||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789 | |||
# 1 2 3 4 5 6 7 8 | |||
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 | |||
item2 | |||
}}}} | |||
{{parW| | {{parW| | ||
{{codeTr|lang=cpp|code= | {{codeTr|lang=cpp|start=300|line=1|width=70|style=border:3px dashed red;|code= | ||
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 | |||
# 1 2 3 4 5 6 7 | |||
#include <time.h> | #include <time.h> | ||
#include <stdio.h> | #include <stdio.h> | ||
void sleep( time_t nb_sec | void sleep( time_t nb_sec ) | ||
{ | { | ||
time_t limit, top; time(&top); limit = top + nb_sec ; | time_t limit, top; time(&top); limit = top + nb_sec ; | ||
Ligne 48 : | Ligne 90 : | ||
int main( int argc, char * argv[] ) | 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)); | 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)); | ||
} | } | ||
}} | }} | ||
}} | }} | ||
</noinclude> | </noinclude> |
Version actuelle datée du 13 février 2024 à 22:09
Version : 1.36.1 2883 (2024-02-13) 20240213220942
Résumé :
Ce modèle sert présenter un code programmation.
{{codeTr|lang=|code=}}
- lang=
- c++ php …
- code=
- le code (text)
- line=1
- start=100
- width
- largeur en nombre de caractères, défaut : 70
- style=border
- 3px dashed blue;
Exemple :
{{parW|{{codeTr|width=75|lang=text|style=border:3px dashed blue;|code= #23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345 # 1 2 3 4 5 6 7 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item2 }}}} {{parW|{{codeTr|line=1|Start=100|width=50|lang=text|code= #23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789 # 1 2 3 4 5 6 7 8 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item2 }}}} {{parW| {{codeTr|lang=cpp|start=300|line=1|width=70|style=border:3px dashed red;|code= #23456789 123456789 123456789 123456789 1234567890123456789 123456789 # 1 2 3 4 5 6 7 #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 :
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 12345
# 1 2 3 4 5 6 7
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1
item2
#23456789 123456789 123456789 123456789 1234567890123456789 123456789 123456789
# 1 2 3 4 5 6 7 8
item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1 item1
item2
#23456789 123456789 123456789 123456789 1234567890123456789 123456789
# 1 2 3 4 5 6 7
#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));
}