Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   case??? (https://www.clubdelphi.com/foros/showthread.php?t=41815)

ivandelphi 26-03-2007 21:50:44

case???
 
alguien me podria decir como puedo hacerle para tratar de realizar un proble con case en delphi tengo que convertir de numero a texto bieno para no hacerlo tan largo aqui le spongo la parte del codigo en el que tengo problemas espero y alguien me pueda decir que hacer gracias!!!

case decena of
1: case uniddad of
0: begin texto7.Text:= 'Diez';end;
1: begin texto7.Text:= 'Once';end;
2: begin texto7.Text:= 'Doce';end;
3: begin texto7.Text:= 'Trece';end;
4: begin texto7.Text:= 'Catirce';end;
5: begin texto7.Text:= 'Quince';end;
6: begin texto7.Text:= 'Dieciseis';end;
7: begin texto7.Text:= 'Diecisiete';end;
8: begin texto7.Text:= 'Dieciocho';end;
9: begin texto7.Text:= 'Diecinueve';end;
end
2: begin texto7.Text:= 'Veinte';end;
3: begin texto7.Text:= 'Treinta';end;
4: begin texto7.Text:= 'Cuarenta';end;
5: begin texto7.Text:= 'Cincuenta';end;
6: begin texto7.Text:= 'Sesenta';end;
7: begin texto7.Text:= 'Setenta';end;
8: begin texto7.Text:= 'Ocheta';end;
9: begin texto7.Text:= 'Noventa';end;
end

jhonny 26-03-2007 21:56:50

Yo creo que lo mejor si es que te extiendas un poco y nos expliques mejor lo que necesitas, pues no se si seré el único pero no entendí lo que necesitas.

Caral 26-03-2007 22:07:32

Hola
Bueno yo me hice un ejemplito mas sencillo, tal vez te guie:
Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
  var
  uniddad : integer;
begin
   uniddad := StrToInt(Edit1.Text);
 case uniddad of
0: begin texto7.Text:= 'Cero';end;
1: begin texto7.Text:= 'uno';end;
2: begin texto7.Text:= 'Dos';end;
3: begin texto7.Text:= 'Tres';end;
4: begin texto7.Text:= 'Cuatro';end;
5: begin texto7.Text:= 'cinco';end;
6: begin texto7.Text:= 'seis';end;
7: begin texto7.Text:= 'siete';end;
8: begin texto7.Text:= 'ocho';end;
9: begin texto7.Text:= 'nueve';end;
10: begin texto7.Text:= 'Diez';end;
11: begin texto7.Text:= 'Once';end;
12: begin texto7.Text:= 'Doce';end;
13: begin texto7.Text:= 'Trece';end;
14: begin texto7.Text:= 'Catirce';end;
15: begin texto7.Text:= 'Quince';end;
16: begin texto7.Text:= 'Dieciseis';end;
17: begin texto7.Text:= 'Diecisiete';end;
18: begin texto7.Text:= 'Dieciocho';end;
19: begin texto7.Text:= 'Diecinueve';end;
20: begin texto7.Text:= 'Veinte';end;
30: begin texto7.Text:= 'Treinta';end;
40: begin texto7.Text:= 'Cuarenta';end;
50: begin texto7.Text:= 'Cincuenta';end;
60: begin texto7.Text:= 'Sesenta';end;
70: begin texto7.Text:= 'Setenta';end;
80: begin texto7.Text:= 'Ocheta';end;
90: begin texto7.Text:= 'Noventa';end;
end;

end;
Saludos

Onti 26-03-2007 22:14:32

Podrías ver este hilo

Crandel 27-03-2007 00:58:55

Caral, a solo modo de comentario, recuerda que no hace falta poner begin y end en cada instruccion del case, dado que tienes una sola expresión.

robandole la frase a Al

saludos simplificados :D


La franja horaria es GMT +2. Ahora son las 12:58:52.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi