« 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... » |
(Aucune différence)
|
Version du 17 juin 2017 à 17:58
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.