
23.05.2009, 12:04
|
|
Постоянный
Регистрация: 05.05.2006
Сообщений: 743
Провел на форуме: 2982851
Репутация:
107
|
|
Я точно не понял чем ГУИ вариант должен отличатся от консольного.Но возможно это так
Код:
#include <vcl.h>
#include <stdio.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int i;
char buffer[500];
i=atoi(Edit1->Text.c_str());
itoa(i,buffer,10);
printf("decimal: %s\n", buffer);
itoa(i,buffer,16);
printf("hexadecimal: %s\n", buffer);
itoa(i, buffer, 2);
printf("binary: %s\n", buffer);
Label1->Caption=buffer;
}
|
|
|