« Mathc initiation/Fichiers c : c02c2 » : différence entre les versions
Contenu supprimé Contenu ajouté
Page créée avec « Catégorie:Mathc initiation (livre) Installer et compiler ces fichiers dans votre répertoire de travail. {{Fichier|c02d.c|largeur=70%|info=|icon=Crystal Clear mime... » |
m <source> -> <syntaxhighlight> (phab:T237267) |
||
Ligne 5 : | Ligne 5 : | ||
{{Fichier|c02d.c|largeur=70%|info=|icon=Crystal Clear mimetype source c.png}} |
{{Fichier|c02d.c|largeur=70%|info=|icon=Crystal Clear mimetype source c.png}} |
||
< |
<syntaxhighlight lang="c"> |
||
/* ------------------------------ */ |
/* ------------------------------ */ |
||
/* Save as : c02c2.c */ |
/* Save as : c02c2.c */ |
||
Ligne 44 : | Ligne 44 : | ||
return 0; |
return 0; |
||
} |
} |
||
</syntaxhighlight> |
|||
</source> |
|||
Ligne 55 : | Ligne 55 : | ||
'''Exemple de sortie écran :''' |
'''Exemple de sortie écran :''' |
||
< |
<syntaxhighlight lang="dos"> |
||
(%+-12.2f) |
(%+-12.2f) |
||
Print the sign. (+) |
Print the sign. (+) |
||
Ligne 80 : | Ligne 80 : | ||
Press return to continue. |
Press return to continue. |
||
</syntaxhighlight> |
|||
</source> |
Version du 16 avril 2020 à 10:06
Installer et compiler ces fichiers dans votre répertoire de travail.
c02d.c |
---|
/* ------------------------------ */
/* Save as : c02c2.c */
/* ------------------------------ */
#include <stdio.h>
/* ------------------------------ */
#include "z_s.h"
/* ------------------------------ */
int main(void)
{
clrscrn();
printf(" (%%+-12.2f)\n");
printf(" Print the sign. (+) \n");
printf(" Push the numbers on the left. (-) \n");
printf(" Reserve a column of 12 characters \n");
printf(" Two figures after the point. \n\n");
printf(" x = %+-12.2f %+-8.2f \n", -1., -1.);
printf(" x = %+-12.2f %+-8.2f \n", 12., 12.);
printf(" x = %+-12.2f %+-8.2f \n", -123., -123.);
printf(" x = %+-12.2f %+-8.2f \n", 1234., 1234.);
printf(" (%%+-12.2e)\n");
printf(" Print the sign. (+) \n");
printf(" Push the numbers on the left. (-) \n");
printf(" Reserve a column of 12 characters \n");
printf(" Two figures after the point. \n");
printf(" e : Scientific notation \n\n");
printf(" x = %+-12.2e %+-8.2f \n", -1., -1.);
printf(" x = %+-12.2e %+-8.2f \n", 12., 12.);
printf(" x = %+-12.2e %+-8.2f \n", -123., -123.);
printf(" x = %+-12.2e %+-8.2f \n", 1234., 1234.);
stop();
return 0;
}
- %f : pour afficher un double poussé sur la droite.
- %12f : réserver douze espace pour afficher le nombre.
- %-12f : pour afficher un double poussé sur la gauche.
- %+-12f : pour afficher un double poussé sur la gauche avec un nombre signé.
- %+-12e : affichage en notation scientifique
Exemple de sortie écran :
(%+-12.2f)
Print the sign. (+)
Push the numbers on the left. (-)
Reserve a column of 12 characters
Two figures after the point.
x = -1.00 -1.00
x = +12.00 +12.00
x = -123.00 -123.00
x = +1234.00 +1234.00
(%+-12.2e)
Print the sign. (+)
Push the numbers on the left. (-)
Reserve a column of 12 characters
Two figures after the point.
e : Scientific notation
x = -1.00e+00 -1.00
x = +1.20e+01 +12.00
x = -1.23e+02 -123.00
x = +1.23e+03 +1234.00
Press return to continue.