NumCode
De Paint
Version : 1.36.1 2917 (2024-02-13) 20240213220948
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));
}
|