Académique Documents
Professionnel Documents
Culture Documents
#include <stdlib.h>
#include <string.h>
#include <conio.h>
/*
La valeur de chiffre ne doit pas d passer la plage de valeur
pour unsigned int c d 4 294 967 295 , sinon il y a erreur de
conversion !!!
*/
switch(dizaine)
{
case 0:
break;
case 1:
dix = true;
break;
case 2:
strcat(lettre,"vingt ");
break;
case 3:
strcat(lettre,"trente ");
break;
case 4:
strcat(lettre,"quarante ");
break;
case 5:
strcat(lettre,"cinquante ");
break;
case 6:
strcat(lettre,"soixante ");
break;
case 7:
dix = true;
strcat(lettre,"soixante ");
break;
case 8:
strcat(lettre,"quatre-vingt ");
break;
case 9:
dix = true;
strcat(lettre,"quatre-vingt ");
} // endSwitch(dizaine)
switch(unite)
{
case 0:
if(dix) strcat(lettre,"dix ");
break;
case 1:
if(dix) strcat(lettre,"onze ");
else strcat(lettre,"un ");
break;
case 2:
if(dix) strcat(lettre,"douze ");
else strcat(lettre,"deux ");
break;
case 3:
if(dix) strcat(lettre,"treize ");
else strcat(lettre,"trois ");
break;
case 4:
if(dix) strcat(lettre,"quatorze ");
else strcat(lettre,"quatre ");
break;
case 5:
if(dix) strcat(lettre,"quinze ");
else strcat(lettre,"cinq ");
break;
case 6:
if(dix) strcat(lettre,"seize ");
else strcat(lettre,"six ");
break;
case 7:
if(dix) strcat(lettre,"dix-sept ");
else strcat(lettre,"sept ");
break;
case 8:
if(dix) strcat(lettre,"dix-huit ");
else strcat(lettre,"huit ");
break;
case 9:
if(dix) strcat(lettre,"dix-neuf ");
else strcat(lettre,"neuf ");
} // endSwitch(unite)
switch (i)
{
case 1000000000:
if(y>1) strcat(lettre,"milliards ");
else strcat(lettre,"milliard ");
break;
case 1000000:
if(y>1) strcat(lettre,"millions ");
else strcat(lettre,"million ");
break;
case 1000:
strcat(lettre,"mille ");
}
} // end if(y!=0)
reste -= y*i;
dix = false;
} // end for
if(strlen(lettre)==0) strcpy(lettre,"zero");
}