Arsip: help: freepascal code to delphi
more 16 years ago
rahadian
Ada yang bisa membantu ,dibawah ini adalah kode yang saya coba untuk konversi dari hexa ke desimal.
aku coba kompile dengan lazarus (freepascal) dapat berjalan dengan baik tetapi tidak untuk delphi 2006
unit
convert;
interface
function HexToDec (Hexadecimal: string): cardinal;
implementation
uses
SysUtils;
function HexToDec (Hexadecimal: string): cardinal;
var
I: cardinal;
Koef: Integer;
Hex: string [8];
const
HexaChars = '123456789ABCDEF';
begin
Hex:=UpperCase (Hexadecimal);
Koef:=1;
HexToDec:=0;
for I:=1 to Length (Hex) do
begin
Inc (HexToDec,Koef Pos(Hex[Length(Hex)-I+1],HexaChars));
Koef:=Koef 16;
end;
end;
end.
dibaris Inc (HexToDec,Koef * Pos(Hex[Length(Hex)-I+1],HexaChars)); keluar error message not enough actual parameter
apa ada yang bisa membantu??
more 16 years ago
mas_kofa
kalo delphi 6 delphi7 tuh ada fungsi bawaan IntToHex.... untuk HexToInt bisa pake fungsi StrToInt , contoh :
procedure TForm1.FormCreate(Sender: TObject);
begin
caption := inttostr(strtoint('$AA'));
end;
hasil = 170;
gmn mas???
more 16 years ago
rahadian
thx 4 the quick reply :D
akan tetapi yang saya tanyakan disini adalah apakah ada ketidakcocokan penulisan kode tersebut pada delphi dengan lazarus yang menggunakan freepascal
more 16 years ago
MrLee
mas rahadian
dibaris Inc (HexToDec,Koef * Pos(Hex[Length(Hex)-I+1],HexaChars)); keluar error message not enough actual parameterHexToDec jgn di pakai seperti itu; klu di pascal memang u/ memngembalikan nilai function; tapi tidak bisa u/ Inc() nya coba di ubah jadi variable terus; baru hasilnya di letakkan di result := semoga terbantu
more 16 years ago
MrLee
mungkin di ubah seperti ini jika mau;
function HexToDec (Hexadecimal: string): cardinal;
var
I, hit: cardinal;
Koef: Integer;
Hex: string [8];
const
HexaChars = '123456789ABCDEF';
begin
Hex:=UpperCase (Hexadecimal);
Koef:=1;
Hit:=0;
for I:=1 to Length (Hex) do
begin
Inc(Hit,Koef Pos(Hex[Length(Hex)-I+1],HexaChars));
Koef:=Koef 16;
end;
result := hit;
end;
more 16 years ago
MrLee
Sama - Sama;
sering post dong di sini;
tentang freePsacal nya;
biar kita bisa tahu juga :D
more ...
- Pages:
- 1
reply |
Report Obsolete
Last Articles
Last Topic
- PascalTalk #6: (Podcast) Kuliah IT di luar negeri, susah gak sih?
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #5: UX: Research, Design and Engineer
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #4: Obrolan Ringan Seputar IT
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #2: Membuat Sendiri SMART HOME
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #3: RADically Fast and Easy Mobile Apps Development with Delphi
by LuriDarmawan in Tutorial & Community Project more 3 years ago - PascalTalk #1: Pemanfaatan Artificial Intelligence di Masa Covid-19
by LuriDarmawan in Tutorial & Community Project more 3 years ago - Tempat Latihan Posting
by LuriDarmawan in OOT more 4 years ago - Archive
- Looping lagi...
by idhiel in Hal umum tentang Pascal Indonesia more 11 years ago - [ask] koneksi ke ODBC user Dsn saat runtime dengan ado
by halimanh in FireBird more 11 years ago - Validasi menggunakan data tanggal
by mas_kofa in Hal umum tentang Pascal Indonesia more 11 years ago
Random Topic
- alias error
by comel in Hal umum tentang Pascal Indonesia more 15 years ago - timer or not timer
by jagur in Hal umum tentang Pascal Indonesia more 17 years ago - Image Grayscale.....
by yadi in Hal umum tentang Pascal Indonesia more 16 years ago - SmsProtocolHttp
by xproof in Tip n Trik Pemrograman more 14 years ago - Kasus: Remote Database, perlukah?
by LuriDarmawan in Bedah Kasus more 17 years ago - ANN: Delphi Package Selector
by deLogic in Free dan Gratis more 16 years ago - kritik soal artikel nih
by agusmade in Kritik & Saran more 19 years ago - Berbagi pengalaman aneh
by ichan29 in Bedah Kasus more 15 years ago - Tolong Coding Print Pada Delphi 7
by sulis in Tip n Trik Pemrograman more 15 years ago - Cached Update Problem dengan Zeos + MySQL
by archvile in MySQL more 16 years ago