masklinn í dag viðrar vel til loftárása | 1- la structure div_t est définie dans stdlib.h, pourquoi tu la redéfinis?
2- une définition de structure dans une fonction? 3- bordel t'as écrit toi même que la sortie de div() est de type div_t, alors pourquoi tu essaies d'imprimer du div_t comme si c'était de l'entier?
Citation :
printf(" la division est de : %d\n",div (a,2));
printf(" le reste de : %d\n",div (a,2));
|
Dans tous les cas t'aurais au moins pu regarder la MSDN, il y a un exemple d'utilisation
Code :
- /* DIV.C: This example takes two integers as command-line
- * arguments and displays the results of the integer
- * division. This program accepts two arguments on the
- * command line following the program name, then calls
- * div to divide the first argument by the second.
- * Finally, it prints the structure members quot and rem.
- */
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
- void main( int argc, char *argv[] )
- {
- int x,y;
- div_t div_result;
- x = atoi( argv[1] );
- y = atoi( argv[2] );
- printf( "x is %d, y is %d\n", x, y );
- div_result = div( x, y );
- printf( "The quotient is %d, and the remainder is %d\n",
- div_result.quot, div_result.rem );
- }
- Output
- x is 876, y is 13
- The quotient is 67, and the remainder is 5
|
Il est sûrement pas magnifique et Taz va gueuler, mais quand même il m'a pas l'air bien compliqué ---------------
I mean, true, a cancer will probably destroy its host organism. But what about the cells whose mutations allow them to think outside the box by throwing away the limits imposed by overbearing genetic regulations? Isn't that a good thing?
|