this is one of my little program
Decimal to Binary or hex
Program KettesLista;
Uses Crt;
Type Tmutato = ^Lista;
Lista = Record
AdatMezo:Byte;
EloreCim:Tmutato;
VisszaCim:Tmutato;
End;
Var A0,A1:Tmutato;
Sz,SzRe:Word;
c:Char;
Procedure Befejez;
Var bf:Byte;
Begin
WriteLn;
For bf:= 0 To 27 Do Write('-');
WriteLn;
Write('-= Created by FlamingClaw =-');
WriteLn;
For bf:= 0 To 27 Do Write('-');
WriteLn;
Write('Kil',#130,'p',#130,'shez nyomj meg egy gombot...');
Repeat
Until KeyPressed;
End;
Procedure Kilep;
Begin
WriteLn('Hib',#160,'s adat!');
Write('Kil',#130,'p',#130,'shez nyomj meg egy gombot...');
ReadKey;
Halt;
End;
Procedure Be1(Var Esz:Word);
Begin
ClrScr;
{$I-}
Write('K',#130,'rem a Sz',#160,'mot: ');
ReadLn(Esz);
{$I+}
If IoResult <> 0 Then Kilep;
End;
Procedure Be2(Var Osz:Word);
Begin
{$I-}
Write('Hanyas Sz',#160,'mrendszerbe 2..16 : ');
ReadLn(Osz);
If (Osz < 2) Or (Osz > 16) Then Kilep;
{$I+}
If IoResult <> 0 Then Kilep;
End;
Procedure Convert(Conv:Word);
Var S:String[1];
Begin
If (Conv <= 9) And (Conv >= 0) Then
Begin
Str(Conv,S);
End
Else Begin
Case (Conv) Of
10:S:='A';
11:S:='B';
12:S:='C';
13:S:='D';
14:S:='E';
15:S:='F';
End;
End;
Write(S);
End;
Procedure Foglal(Var x,y:Word);
Begin
A0:=Nil;
While (x <> 0) Do
Begin
New(A1);
A1^.AdatMezo:= x Mod y;
If (A0 = Nil) Then
Begin
A0:=A1;
A0^.VisszaCim:=Nil;
End
Else Begin
A1^.VisszaCim:=A0;
A0^.EloreCim:=A1;
A0:=A1;
End;
x:= x Div y;
End;
End;
Procedure Pusztit;
Begin
A1:=A0;
While A1<>Nil Do
Begin
A0:=A1^.VisszaCim;
Dispose(A1);
A1:=A0;
End;
End;
Procedure Kiolvas;
Begin
A1:=A0;
While (A1 <> Nil) Do
Begin
Convert(A1^.AdatMezo);
A1:=A1^.VisszaCim;
End;
End;
Begin
Repeat
Be1(Sz);
Be2(SzRe);
Foglal(Sz,SzRe);
Kiolvas;
Pusztit;
WriteLn;
Write('Esc kil‚p‚s! Folytassuk?');
c:= ReadKey;
ClrScr;
Until c=#27;
Befejez;
End.
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.