Programa de numeros a texto | Ayuda es para mañana
Publicado por Jose Flores (2 intervenciones) el 30/05/2019 04:31:35
Tengo este programa que convierte numeros enteros a texto, lo tengo desde el 0 hasta el 30,00 hoy el profe quiere que llegue hasta 9,999,999 de un dia para otro realmente ya me bloquie la mente y lo peor es que es de un dia para otro por favor ayuda!.
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/*Generar un programa en el que el usuario solo va introducir
un numero y al momento de introducir un valor aparecera
el mismo escrito con numeros*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define P printf
#define S scanf
void main()
{
system("color 2");
int numero, n1, n2, n3, n4, n5, n6,opc=1;
P("Bienvenido Este Programa Convierte un numero a letras\n");
while(opc==1)
{
P("Escribe un numero entre 0 y 32,768:\n");
S("%d",&numero);
n1 = numero / 10000;
n2 = (numero / 1000) % 10;
n3 = (numero / 100) % 10;
n4 = (numero / 10) % 10;
n5 = (numero % 10);
if(numero <0 || numero >32768){
system("cls");
P("El numero ingresado excede el rango de valores, Desea introducir otro numero: \n1)si\n2)No\n");
S("%d",&opc);
}else{
P("\n%d Decenas de Mil",n1);
P("\n%d Unidades de Mil",n2);
P("\n%d Centenas",n3);
P("\n%d Decenas",n4);
P("\n%d Unidades \n\n",n5);
if(n1 == 1 && n2==0 && n3==0 && n4==0 &&n5==0){
P("DIEZ MIl ");
}else
if(n1==1 && n2==1 ){
P("ONCE MIL ");
}else
if(n1==1 && n2==2 ){
P("DOCE MIL ");
}else
if(n1==1 && n2==3 ){
P("TRECE MIL ");
}else
if(n1==1 && n2==4 ){
P("CATORCE MIL ");
}else
if(n1==1 && n2==5 ){
P("QUINCE MIL ");
}else
if(n1==1 && n2==6 ){
P("DIECISEIS MIL ");
}else
if(n1==1 && n2==7 ){
P("DIECISIETE MIL ");
}else
if(n1==1 && n2==8 ){
P("DIECIOCHO MIL ");
}else
if(n1==1 && n2==9 ){
P("DIECINUEVE MIL ");
}else
if(n1 == 2 && n2==0 && n3==0 && n4==0 &&n5==0 ){
P("VEINTE MIL ");
}else
if(n1 == 2 && n2==1 ){
P("VEINTIUN MIL ");
}else
if(n1 == 2 && n2==2 ){
P("VEINTIDOS MIL ");
}else
if(n1 == 2 && n2==3 ){
P("VEINTITRES MIL ");
}else
if(n1 == 2 && n2==4 ){
P("VEINTICUATRO MIL ");
}else
if(n1 == 2 && n2==5 ){
P("VEINTICINCO MIL ");
}else
if(n1 == 2 && n2==6 ){
P("VEINTISEIS MIL ");
}else
if(n1 == 2 && n2==7 ){
P("VEINTISIETE MIL ");
}else
if(n1 == 2 && n2==8 ){
P("VEINTIOCHO MIL ");
}else
if(n1 == 2 && n2==9 ){
P("VEINTINUEVE MIL ");
}else
if(n1 == 3 && n2==0 && n3==0 && n4==0 && n5==0){
P("TREINTA MIL ");
}else
if(n1 == 3 && n2==1 ){
P("TREINTA Y UN MIL ");
}else
if(n1 == 3 && n2==2 ){
P("TREINTA Y DOS MIL ");
}else
if(n2 == 1){
P("MIL ");
}else if(n2 == 2){
P("DOS MIL ");
}else if(n2 == 3){
P("TRES MIL ");
}else if(n2 == 4){
P("CUATRO MIL ");
}else if(n2 == 5){
P("CINCO MIL ");
}else if(n2 == 6){
P("SEIS MIL ");
}else if(n2 == 7){
P("SIETE MIL ");
}else if(n2 == 8){
P("OCHO MIL ");
}else if(n2 == 9){
P("NUEVE MIL ");
}
if(n3 == 1 && n4 == 0 && n5 == 0){
P("CIEN");
}else if(n3 == 1){
P("CIENTO ");
}else if(n3 == 2){
P("DOSCIENTOS ");
}else if(n3 == 3){
P("TRESCIENTOS ");
}else if(n3 == 4){
P("CUATROCIENTOS ");
}else if(n3 == 5){
P("QUINIENTOS ");
}else if(n3 == 6){
P("SEISCIENTOS ");
}else if(n3 == 7){
P("SETECIENTOS ");
}else if(n3 == 8){
P("OCHOCIENTOS ");
}else if(n3 == 9){
P("NOVECIENTOS ");
}
//Setencia para determinar las decenas
if(n4 == 1 && n5 == 0){
P("Diez");
}else if(n4 == 1 && n5 == 1){
P("ONCE");
}else if(n4 == 1 && n5 == 2){
P("DOCE");
}else if(n4 == 1 && n5 == 3){
P("TRECE");
}else if(n4 == 1 && n5 == 4){
P("CATORCE");
}else if(n4 == 1 && n5 == 5){
P("QUINCE");
}else if(n4 == 1){
P("DIECI");
}
if(n4 == 2 && n5 == 0){
P("VEINTE");
}else if(n4 == 2){
P("VEINTI");
}else if(n4 == 3 && n5 == 0){
P("TREINTA");
}else if(n4 == 3){
P("TREINTA Y ");
}else if(n4 == 4 && n5 == 0){
P("CUARENTA");
}else if(n4 == 4){
P("CUARENTA Y ");
}else if(n4 == 5 && n5 == 0){
P("CINCUENTA");
}else if(n4 == 5){
P("CINCUENTA Y ");
}else if(n4 == 6 && n5 == 0){
P("SESENTA");
}else if(n4 == 6){
P("SESENTA Y ");
}else if(n4 == 7 && n5 == 0){
P("SETENTA");
}else if(n4 == 7){
P("SETENTA Y ");
}else if(n4 == 8 && n5 == 0){
P("OCHENTA");
}else if(n4 == 8){
P("OCHENTA Y ");
}else if(n4 == 9 && n5 == 0){
P("NOVENTA");
}
else if(n4 == 9){
P("NOVENTA Y ");
}
//Sentencia para determinar las unidades
if(n5 == 1 && n4 > 1){
P("UNO");
}else if(n5 == 1 && n4 == 0){
P("UNO");
}else if(n5 == 2 && n4 > 1){
P("DOS");
}else if(n5 == 2 && n4 == 0){
P("DOS");
}else if(n5 == 3 && n4 > 1){
P("TRES");
}else if(n5 == 3 && n4 == 0){
P("TRES");
}else if(n5 == 4 && n4 > 1){
P("CUATRO");
}else if(n5 == 4 && n4 == 0){
P("CUATRO");
}else if(n5 == 5 && n4 > 1){
P("CINCO");
}else if(n5 == 5 && n4 == 0){
P("CINCO");
}else if(n5 == 6){
P("SEIS");
}else if(n5 == 7){
P("SIETE");
}else if(n5 == 8){
P("OCHO");
}else if(n5 == 9){
P("NUEVE");
}
if(n1==0 && n2==0 && n3==0 && n4==0 && n5==0){
P("CERO");
}
P("\n\nDesea Introducir Otro numero:\n1)Si\n2)No\n");
S("%d",&opc);
system("cls");
}
}
P("Hasta luego!!!");
getch();
Valora esta pregunta


0