j'aimerai bien que vous m'aidez à fusionner mon mini projet car je suis nulle dans le les fonctions (car j'ai absenté dans le cours et maintenant j'ai le regret ...)

voila le premier code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<stdio.h>
#include<string.h>
#include<conio.h>
 
 int main(void)
{
char l1[50],l2[50],l3[50],l4[50], lettre[256];
char *espace = " ",choix = 'o';
char unite[25][25]={"end","un","deux","trois","quatre", "cinq", "six", "sept", "huit","neuf","dix","onze","douze","treize","quatorze","quinze","seize","dix-sept","dix-huit","dix-neuf"};
char dizaine[25][25]={"","","vingt","trente","quarante","cinquante","soixante","","quatre-vingt",""};
char centaine[3][6]={"end","cent","cents"};
int s,i,x1,x2,x3,x4;
strcpy(lettre,"");
while((choix=='o')||(choix=='O'))
 {
printf("donner une chiffre literalement\n");
scanf("%s",&l1);
scanf("%s",&l2);
scanf("%s",&l3);
scanf("%s",&l4);
 
strcat(lettre,l1);
strcat(lettre,espace);
strcat(lettre,l2);
strcat(lettre,espace);
strcat(lettre,l3);
strcat(lettre,espace);
strcat(lettre,l4);
 
printf("%s\n",lettre);
 
for(i=0;i<25 || (strcmp(l1,unite[i])==0) ;i++)
if (strcmp(l1,unite[i])==0)
x1=i;
 
for(i=0;i<25 || (strcmp(l2,centaine[i])==0) ;i++)
if (strcmp(l2,centaine[i])==0)
x2=100;
 
for(i=0;i<25 || (strcmp(l3,dizaine[i])==0) ;i++)
if (strcmp(l3,dizaine[i])==0)
x3=10*i;
 
for(i=0;i<30 || (strcmp(l4,unite[i])==0) ;i++)
if (strcmp(l4,unite[i])==0)
x4=i;
 
printf(" ca fait :%d  ",x1*x2+x3+x4);
printf("\nEncore d'autre? (O/N): ");
 choix = getche();
 printf("\n===================================================\n");
}//nendwhile
getch();
return 0;
}
et le 2eme
:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#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:
 if(unite==0)strcat (lettre,"soixante-dix ");
 else strcat (lettre,"soixante ");
 
 break;
 case 8:
 strcat(lettre,"quatre-vingt ");
 break;
 case 9:
  if(unite==0)strcat(lettre,"quatre-vingt-dix ");
  else strcat(lettre,"quatre-vingt ");
 } // endSwitch(dizaine)
 
 switch(unite)
 {
 case 0:
 break;
 case 1:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"onze ");
 else strcat(lettre,"un ");
 break;
 case 2:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"douze ");
 else strcat(lettre,"deux ");
 break;
 case 3:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"treize ");
 else strcat(lettre,"trois ");
 break;
 case 4:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"quatorze ");
 else strcat(lettre,"quatre ");
 break;
 case 5:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"quinze ");
 else strcat(lettre,"cinq ");
 break;
 case 6:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"seize ");
 else strcat(lettre,"six ");
 break;
 case 7:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"dix-sept ");
 else strcat(lettre,"sept ");
 break;
 case 8:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) strcat(lettre,"dix-huit ");
 else strcat(lettre,"huit ");
 break;
 case 9:
 if(dizaine == 1 || dizaine == 7 || dizaine == 9 ) 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");
 
 }
merci d'avance

il vaudra mieux qu'on fait un "main" qui fait le choix 1 ou 2 pour appeler le programme 1 ou 2

Merci d'avance