//---------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <stdio.h>
#include <stdlib.h>
#include "Unit1.h"
//---------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------
void __fastcall TForm1::Edit1KeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
char tmpChar[200] ;
itoa (Edit1->Text.ToInt(),tmpChar,2);
Edit2->Text = AnsiString(tmpChar) ;
itoa (Edit1->Text.ToInt(),tmpChar,16);
Edit3->Text = "0X " + UpperCase(AnsiString(tmpChar)) ;
}
//---------------------------------------
void __fastcall TForm1::Edit2KeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
long tmpNum ;
char tmpChar[200] ;
tmpNum = strtol (Edit2->Text.c_str(),NULL,2);
Edit1->Text = StrToInt(tmpNum) ;
itoa (Edit1->Text.ToInt(),tmpChar,16);
Edit3->Text = UpperCase(AnsiString(tmpChar)) ;
}
//---------------------------------------
void __fastcall TForm1::Edit3KeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
long tmpNum ;
char tmpChar[200] ;
tmpNum = StrToInt("$" + Edit3->Text) ;
Edit1->Text = StrToInt(tmpNum) ;
itoa (Edit1->Text.ToInt(),tmpChar,2);
Edit2->Text = AnsiString(tmpChar) ;
}
//---------------------------------------