Pascal/Turbo Pascal - ayuda con programa para escribir en celular

 
Vista:

ayuda con programa para escribir en celular

Publicado por imsr (1 intervención) el 27/08/2011 15:53:13
Hola gente!
soy nuevo en pascal y tengo que crear un programa en pascal que represente la escritura de un celular
0 0
1 . , ? 1
2 a b c 2
3 d e f 3
4 g h i 4
5 j k l 5
6 m n o 6
7 p q r s 7
8 t u v 8
9 w x y z 9
# espacio
* minúscula/mayúscula
por ejemplo escribiendo
44666555211110L
tendria que salir
hola10
la "L" es un centinela
pero no tengo ni idea de como siquiera empesar
yo pensaba en definir constantes
a=2
b=22
c=222
pero el tema es que al escribir todos los numeros en una sola linea 44666555211110L no se como podria hacer que el readLn me lea solo la repeticion de 4s (por ejemplo) capas que saben alguna funcion del read que lea solo las repetiiones .
bueno si me pudieran guiar un poco se los agradeceria muchisimo
saludos!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

ayuda con programa para escribir en celular

Publicado por ramon (2158 intervenciones) el 02/09/2011 20:12:49
{Mira te sirve esto}

program tecatele;
uses
crt;
const
nume : array[1..12] of char = ('0','1','2','3','4','5','6','7','8','9',
'#','*');
var
tecla : char;
datoen : string[4];
todo : string;
x0, y0, tt, x3, y3 : integer;



procedure teclado;
var
y, x : integer;
begin
textcolor(15);
x := 5;
y := 3;
gotoxy(x,y);write('teclado de telefono celular');
x := 10;
gotoxy(x,y + 3);write('[','0',']',' ','[','1',']',' ','[','2',']');
textcolor(10);
gotoxy(x,y + 4);write(' 0 ',' .,?',' abc');
textcolor(15);
gotoxy(x,y + 6);write('[','3',']',' ','[','4',']',' ','[','5',']');
textcolor(10);
gotoxy(x,y + 7);write('def',' ghi',' jkl');
textcolor(15);
gotoxy(x,y + 9);write('[','6',']',' ','[','7',']',' ','[','8',']');
textcolor(10);
gotoxy(x,y + 10);write('mno',' pqrs',' tuv');
textcolor(15);
gotoxy(x,y + 12);write('[','9',']',' ','[','#',']',' ','[','*',']');
textcolor(10);
gotoxy(x,y + 13);write('wxyz',' esp.',' m/M');
end;

procedure entradas;
var
linea, az, cual, dd, x1, y1 : integer;
letra, ante : char;
no, mayu : boolean;
begin
teclado;
mayu := false;
no := false;
dd := 1;
x1 := 10;
y1 := 18;
az := 1;
textcolor(12);
gotoxy(x1,y1);write('Entrada Texto Teclado Numerico');
textcolor(15);
y1 := 19;
x3 := x1;
y3 := y1;
gotoxy(x1,y1);
cual := 0;
linea := 0;
ante := ' ';
letra := ' ';
repeat
tecla := readkey;
if tecla in[#48..#57,#35,#42] then
begin
ante := tecla;
tecla := #0;
cual := cual + 1;
for az := 1 to 100 do
begin
if keypressed then
tecla := readkey;
if tecla = ante then
begin
az := 1;
cual := cual + 1;
ante := tecla;
tecla := #0;
end;
delay(6);
end;
end;
case ante of
#48 : letra := '0';
#49 : begin
letra := ' ';
case cual of
1 : letra := '.';
2 : letra := ',';
3 : letra := '?';
4 : letra := '1';
end;
end;
#50 : begin
letra := ' ';
case cual of
1 : letra := 'a';
2 : letra := 'b';
3 : letra := 'c';
4 : letra := '2';
end;
end;
#51 : begin
letra := ' ';
case cual of
1 : letra := 'd';
2 : letra := 'e';
3 : letra := 'f';
4 : letra := '3';
end;
end;
#52 : begin
letra := ' ';
case cual of
1 : letra := 'g';
2 : letra := 'h';
3 : letra := 'i';
4 : letra := '4';
end;
end;
#53 : begin
letra := ' ';
case cual of
1 : letra := 'j';
2 : letra := 'k';
3 : letra := 'l';
4 : letra := '5';
end;
end;
#54 : begin
letra := ' ';
case cual of
1 : letra := 'm';
2 : letra := 'n';
3 : letra := 'o';
4 : letra := '6';
end;
end;
#55 : begin
letra := ' ';
case cual of
1 : letra := 'p';
2 : letra := 'q';
3 : letra := 'r';
4 : letra := 's';
5 : letra := '7';
end;
end;
#56 : begin
letra := ' ';
case cual of
1 : letra := 't';
2 : letra := 'u';
3 : letra := 'v';
4 : letra := '8';
end;
end;
#57 : begin
letra := ' ';
case cual of
1 : letra := 'w';
2 : letra := 'x';
3 : letra := 'y';
4 : letra := 'z';
5 : letra := '9';
end;
end;
#35 : letra := #32;
#42 : begin
if mayu = false then
mayu := true
else
mayu := false;
no := true;
letra := ' ';
end;
end;
cual := 0;
if (no = false) and (tecla <> #13) then
begin
if mayu = false then
letra := letra
else
letra := upcase(letra);
todo[dd] := letra;
todo[0] := chr(dd);
gotoxy(x1 + linea,y1);write(todo[dd]);
dd := dd + 1;
linea := linea + 1;
if linea > 15 then
begin
y1 := y1 + 1;
x1 := x3;
gotoxy(x1,y1);
linea := 0;
todo[dd] := #13;
todo[0] := chr(dd);
dd := dd + 1;
end;
end
else
begin
no := false;
end;
until tecla = #13;
end;

begin
clrscr;
entradas;
gotoxy(x3,y3);clreol;
textcolor(10);
x0 := x3 - 1;
y0 := y3;
for tt := 1 to length(todo) do
begin
if todo[tt] = #13 then
begin
y0 := y0 + 1;
x0 := x3 - 1;
end;
gotoxy(x0,y0);write(todo[tt]);
x0 := x0 + 1;
end;
readln;
end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar