C#的:
namespace WindowsApplication1
{
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.WinForms;
using System.Data;
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.WinForms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components;
private System.WinForms.Button button1;
public uint m, n, t;
[sysimport(dll="winmm.dll")]
public static extern uint timeGetTime();
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
public override void Dispose()
{
base.Dispose();
components.Dispose();
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container ();
this.button1 = new System.WinForms.Button ();
//@this.TrayHeight = 0;
//@this.TrayLargeIcon = false;
//@this.TrayAutoArrange = true;
button1.Location = new System.Drawing.Point (184, 152);
button1.Size = new System.Drawing.Size (75, 23);
button1.TabIndex = 0;
button1.Text = "button1";
button1.Click += new System.EventHandler (this.button1_Click);
this.Text = "Form1";
this.AutoScaleBaseSize = new System.Drawing.Size (6, 14);
this.Controls.Add (this.button1);
}
for (i=0;i<=j;i++)
{
for (k=0;k<=j;k++)
{
m-=timeGetTime();
n+=m;
m+=n;
n*=m;
m*=n;
}
}
t=timeGetTime()-t;
this.Text=t.ToString();
}
/// <summary>
/// The main entry point for the application.
/// </summary>
public static void Main(string[] args)
{
Application.Run(new Form1());
}
}
}
Delphi的:
var
Form1: TForm1;
m,n,t: Dword;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
i,j,k: Dword;
begin
n:=7;
m:=3;
j:=3000;
t:=timegettime;
for i:=0 to j do
for k:=0 to j do
begin
m:=m-timeGetTime();
n:=n+m;
m:=m+n;
n:=n*m;
m:=m*n;
end;
Caption:=IntToStr(timegettime-t);
end;