PDA

View Full Version : mấy anh xem giúp em bài này với



DinhHai
02-03-2012, 20:10
viết CT hiện lên màn hình 256 kí tự của bản mã ASC II

motien
02-03-2012, 20:54
1 câu lệnh là được
for i:=1 to 256 do writeln(i,' -> ',chr(i));

mrjokes
02-03-2012, 20:57
For i:=1 to 256 do
Write(chr(i));

mrjokes
02-03-2012, 20:58
1 câu lệnh là được
for i:=1 to 256 do writeln(i,' -> ',chr(i));
ban ay bao chi ht 256 ki tu thoi ma`,sao lai co' ca i ha ban

motien
02-03-2012, 21:00
ban ay bao chi ht 256 ki tu thoi ma`,sao lai co' ca i ha ban

cũng đâu có sai

auauau97
18-03-2012, 08:22
trình bày cả bài cho bạn:


Uses crt;
Var
i:integer;
BEGIN
Clrscr;
For i:=1 to 256 do Write(i,':',chr(i));
Readln;
END.

AVATARBLACK
18-09-2012, 21:49
Mình cho bạn bản code trực giác (lập trình đồ họa):
Program AsciTable;
Uses Crt, Addcrt;
Label 1;
Const Hexa:Array[0..15] of Char='0123456789ABCDEF';
Type St=String;
Var i,j,x,m,n,y,e:Integer;
ch:Char;

Procedure Color(x1,x2,y1,y2:Byte);
Begin
Tomau(x1,y1,x2,y2,3);
Tomau(x1+2,y1+2,x2-2,y2-2,3);
End;

Function Doi(i1:Byte):St;
Begin
Doi:=Hexa[i1 Shr 4]+Hexa[i1 And $0F];
End;

Begin {Main}
TextBackGround(3);
clrscr;
Cursor(1);
Khungdon(2,2,79,24,15);TextC(14,9); Writexy(35,2,' TABLE ASCII ');
TextC(1,15);
WriteXY(50,3,'Wroten By Astone Tate'); TextC(4,3);
Window(2,4,79,24);
x:=1; y:=1;
While (x<=72) Do
Begin
Khungdon(x+2,y,x+8,y+2,15);
Khungdon(x+2,y+2,x+8,y+19,15);
x:=x+6;
End;
i:=3;
While (i<=79) Do
Begin
GotoXY(i,3); Write(#197);
i:=i+6;
End;
WriteXY(3,3,'*'); WriteXY(75,3,'*');
i:=9;
While (i<=79) Do
Begin
WriteXY(i,1,'*');
i:=i+6;
End;
WriteXY(75,1,'*');
i:=9;
While (i<=79) Do
Begin
WriteXY(i,20,'*');
i:=i+6;
End;
WriteXY(75,20,'*');
TextC(1,3); x:=5;
For i:=1 to 4 Do Begin WriteXY(x,2,'Deci'); x:=x+18; End; x:=11;
For i:=1 to 4 Do Begin WriteXY(x,2,'Hexa'); x:=x+18; End; x:=17;
For i:=1 to 4 Do Begin WriteXY(x,2,'Char'); x:=x+18; End;
Repeat
m:=64; n:=16;
Window(4,4,76,24);
y:=2; i:=4; j:=1; e:=4;
Repeat
While (i<=m) And (j<=n) Do
Begin
TextC(e,3); WriteXY(15,10,' ');
WriteXY(15,11,' '); WriteXY(15,13,' ');
WriteXY(15,16,' ');
GotoXY(y,i); Write(j:3);
GotoXY(y+6,i); Write(Doi(j):3);
If (j<>7) Then
Begin
GotoXY(y+12,i); Write(chr(j):3);
End;
i:=i+1; j:=j+1;
End;
y:=y+18; i:=4; n:=n+16; e:=e+2;
Until n=80;
SetWin;

WriteXY(40,24,'PgDn->Continue; Other Key->Quit.');
ch:=Readkey;
If ch=#0 then ch:=Readkey; If ch<>#81 then Goto 1;
m:=128; n:=80;
Window(4,4,76,24);
y:=2;i:=4; j:=65; e:=4;
Repeat
While (i<=m) And(j<=n) Do
Begin
TextC(e,3);
GotoXY(y,i); Write(j:3);
GotoXY(y+6,i); Write(Doi(j):3);
GotoXY(y+12,i); Write(chr(j):3);
i:=i+1; j:=j+1;
End;
y:=y+18; i:=4; n:=n+16; e:=e+2;
Until n=144;
Setwin;
Write(40,24,'PgDn->Continue; Other key->Quit.'); ch:=Readkey;
If ch=#0 then ch:=Readkey; If ch<>#81 then Goto 1;
m:=192; n:=144;
Window(4,4,76,24);
y:=2; i:=4; j:=129; e:=4;
Repeat
While (i<=m) And (j<=n) do
Begin
TextC(e,3);
GotoXY(y,i); Write(j:3);
GotoXY(y+6,i); Write(Doi(j):3);
GotoXY(y+12,i); Write(chr(j):3);
i:=i+1; j:=j+1;
End;
y:=y+18; i:=4; n:=n+16; e:=e+2;
Until n=208;
Setwin;
Write(40,24,'PgDn->Continue; Other key->Quit.'); ch:=Readkey;
If ch=#0 then ch:=Readkey; If ch<>#81 then Goto 1;
m:=256; n:=208;
Window(4,4,76,24);
y:=2; i:=4; j:=193; e:=4;
Repeat
While (i<=m) And (j<=n) Do
Begin
TextC(e,3);
GotoXY(y,i); Write(j:3);
GotoXY(y+6,i); Write(Doi(j):3);
GotoXY(y+12,i); Write(chr(j):3);
i:=i+1; j:=j+1;
End;
y:=y+18; i:=4; n:=n+16; e:=e+2;
Until n=272;
Setwin;
Write(40,24,'PgDn->Continue; Other key->Quit.'); ch:=Readkey;
If ch=#0 then ch:=Readkey; If ch<>#81 then Goto 1;
Until ch=#27;
Setwin;
1:TextC(15,0); Clrscr;
End.