CodeTr
De astroWiki
Version : 1.36.1 1425 (2021-09-4) 20210904084832
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));
}