Code
De Paint
Révision datée du 26 mars 2021 à 13:46 par toross>Atoross
Version : 1.36.1 2211 (2021-03-26) 20210326134608
Résumé :
Ce modèle sert présenter un code programmation.
{{code|lang=|code=}}
- lang=
- c++ php …
- code=
- le code
- colNb
- nombre de caractères en largeur (nombre de colonnes)
- line
- active la numérotation, mettre n'importe quelle valeur
- lineStart
- numéro de ligne de départ, par défaut 1
Exemple :
{{parW|1= {{code|colNb=80|lang=cpp|code= #2345678901234567890123456789012345678901234567890123456789012345678901234567890 # 1 2 3 4 5 6 7 8 #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)); } }} }} {{parW|1= {{code|lang=cpp|colNb=86|code= #2345678901234567890123456789012345678901234567890123456789012345678901234567890 # 1 2 3 4 5 6 7 8 #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 :
#2345678901234567890123456789012345678901234567890123456789012345678901234567890
# 1 2 3 4 5 6 7 8
#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));
}
#2345678901234567890123456789012345678901234567890123456789012345678901234567890
# 1 2 3 4 5 6 7 8
#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));
}