c++builder 简单的自定义函数例程

#include
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
int max(const int &a, const int &b)
{  if (a>b)
 {
  return a;
   }
   else
   return b;
}
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   int a=112,b=5;
   Edit1->Text=IntToStr(max(a,b));
}
//---------------------------------------------------------------------------
 

你可能感兴趣的:(编程)