CodeTr

De Paint
Révision datée du 20 juillet 2014 à 18:08 par WikiAdmin (discussion | contributions) (1 version)
Version : 1.36.1 616 (2014-07-20) 20140720180856
Auteurs :
Arthur Torossian
Résumé :
Ce modèle sert présenter un code programmation.

{{codeTr|lang=|code=}}

lang=
c++ php …
code=
le code

Exemple :

{{parW|{{codeTr|lang=cpp|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 :


#include

   #include 
   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 ); pri↲ ↳ntf("in seconds: %f\n",difftime(stop,start));

   }