Logiciel Borland C++ et DevC++

cs_waldomania Messages postés 1 Date d'inscription mardi 29 décembre 2009 Statut Membre Dernière intervention 30 décembre 2009 - 30 déc. 2009 à 10:56
cs_rt15 Messages postés 3874 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 7 novembre 2014 - 1 janv. 2010 à 20:03
Bonjour,
j'ai un grand problème car j'ai programmé un mini projet sur un Dev C++ mais ça marche pas à Borland C++
le projet est en langage c (!=C++)

comment je peut le fonctionner dans Borland et pourquoi ça ne fonction qu'avec DevC++?

#include<stdio.h>
#include<string.h>
#include<conio.h>

 void ChiffreEnLettre(int, char*);
int main()
 {
 int chiffre = 0;
 char choix = 'o',lettre[256];
 while((choix=='o')||(choix=='O'))
 {
 printf("Introduire un chiffre entier : ");
 scanf("%d", &chiffre);
 ChiffreEnLettre(chiffre,lettre);
 printf("\nEn lettre ca fait %s: ", lettre);
 
 printf("\nEncore d'autre? (O/N): ");
 choix = getche();
 printf("\n===================================================\n");
 }
 return 0;
 }



void ChiffreEnLettre(int chiffre , char lettre[256])
 {
 int centaine, dizaine, unite, reste, y,i;

      
 reste = chiffre;
 strcpy(lettre, "");


 for(i=1000000000; i>=1; i/=1000)
 {
 //printf("rest:%d,chiffre:%d",reste,chiffre);
 y = reste/i;
 /*printf("%d",reste);
 printf("%d",chiffre);
 printf("%d",y);
 printf("%d",i);*/
 if(y!=0)
 {
 centaine = y/100;
 dizaine = (y - centaine*100)/10;
 unite = y-(centaine*100)-(dizaine*10);
 switch(centaine)
 {
 case 0:
 break;
 case 1:
 strcat(lettre,"cent ");
 break;
 case 2:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"deux cents ");
 else strcat(lettre,"deux cent ");
 break;
 case 3:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"trois cents ");
 else strcat(lettre,"trois cent ");
 break;
 case 4:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"quatre cents ");
 else strcat(lettre,"quatre cent ");
 break;
 case 5:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"cinq cents ");
 else strcat(lettre,"cinq cent ");
 break;
 case 6:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"six cents ");
 else strcat(lettre,"six cent ");
 break;
 case 7:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"sept cents ");
 else strcat(lettre,"sept cent ");
 break;
 case 8:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"huit cents ");
 else strcat(lettre,"huit cent ");
 break;
 case 9:
 if((dizaine 0)&&(unite 0)) strcat(lettre,"neuf cents ");
 else strcat(lettre,"neuf cent ");
 }// endSwitch(centaine)

 switch(dizaine)
 {
 case 0:
 break;
 case 1:
 if(unite==0) strcat(lettre,"dix");
 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:
 strcat (lettre,"soixante-dix ");
 break;
 case 8:
 strcat(lettre,"quatre-vingt ");
 break;
 case 9:
 strcat(lettre,"quatre-vingt-dix ");
 } // endSwitch(dizaine)

 switch(unite)
 {
 case 0:
 break;
 case 1:
 if(dizaine == 1) strcat(lettre,"onze ");
 else strcat(lettre,"un ");
 break;
 case 2:
 if(dizaine == 1) strcat(lettre,"douze ");
 else strcat(lettre,"deux ");
 break;
 case 3:
 if(dizaine == 1) strcat(lettre,"treize ");
 else strcat(lettre,"trois ");
 break;
 case 4:
 if(dizaine == 1) strcat(lettre,"quatorze ");
 else strcat(lettre,"quatre ");
 break;
 case 5:
 if(dizaine == 1) strcat(lettre,"quinze ");
 else strcat(lettre,"cinq ");
 break;
 case 6:
 if(dizaine == 1) strcat(lettre,"seize ");
 else strcat(lettre,"six ");
 break;
 case 7:
 if(dizaine == 1) strcat(lettre,"dix-sept ");
 else strcat(lettre,"sept ");
 break;
 case 8:
 if(dizaine == 1) strcat(lettre,"dix-huit ");
 else strcat(lettre,"huit ");
 break;
 case 9:
 if(dizaine == 1) 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;
 } // end for
 if(strlen(lettre)==0) strcpy(lettre,"zero");

 }

vraiment j'ai commencé de devenir fou car le logiciel utilisé dans mon soutenance est Borland

1 réponse

cs_rt15 Messages postés 3874 Date d'inscription mardi 8 mars 2005 Statut Modérateur Dernière intervention 7 novembre 2014 13
1 janv. 2010 à 20:03
Salut,

Quelle version de C++ Builder utilises-tu ?
Peux tu copier-coller ici le ou les message(s) d'erreur ?
0
Rejoignez-nous