跪求vb,delphi 高手把下面代码改成delphi的

TypeEvalTypeNameAsString'nameofevaluationfactor(e.g.NE-Diet)UnitsAsString'unitsofeval... Type EvalType
Name As String ' name of evaluation factor (e.g. NE-Diet)
Units As String ' units of evaluation factor (e.g. Mcal/day)
Total As Single
Maint As Single
Preg As Single
Lact As Single
Gain As Single
Reserves As Single
End Type
Public EvalFactor(1 To 6) As EvalType
Private Sub DietEvalOneComputations()

Dim X As Integer

' The EvalFactors are calculated here as follows :
'
' NE Diet, NE Required, NE Differ, MP Diet, MP Required, MP Differ
' Mcal/d Mcal/d Mcal/d g/d g/d g/d

If AnimalType <> "Replacement Heifer" Then
EvalFactor(1).Name = "NE Supplied"
EvalFactor(2).Name = "NE Required"
EvalFactor(3).Name = "NE (Diet - Req.)"
EvalFactor(4).Name = "MP Diet"
EvalFactor(5).Name = "MP Required"
EvalFactor(6).Name = "MP (Diet - Req.)"
Else
EvalFactor(1).Name = "ME Supplied"
EvalFactor(2).Name = "ME Required"
EvalFactor(3).Name = "ME (Diet - Req.)"
EvalFactor(4).Name = "MP Diet"
EvalFactor(5).Name = "MP Required"
EvalFactor(6).Name = "MP (Diet - Req.)"
End If

For X = 1 To 6
If X < 4 Then
EvalFactor(X).Units = "Mcal/day"
Else
EvalFactor(X).Units = "g/day"
End If
Next X

If AnimalType <> "Replacement Heifer" Then
EvalFactor(1).Total = NEl_Total
Else
EvalFactor(1).Total = MEng_Total
End If

EvalFactor(1).Maint = EvalFactor(1).Total

If AnimalType <> "Replacement Heifer" Then
EvalFactor(2).Maint = NEMaint
Else
If NEmOverMEng > 0 Then
EvalFactor(2).Maint = NEMaint / NEmOverMEng
Else
EvalFactor(2).Maint = 0
End If
End If
展开
 我来答
遒劲且威武的小白桦s
2012-02-01 · TA获得超过115个赞
知道小有建树答主
回答量:160
采纳率:0%
帮助的人:192万
展开全部
//由于提供的代码不全,只能根据给出的代码进行改写,具体如下:
type
EvalType = packed record //原本想新建一个类 但考虑到类需要实例化 还是用结构比较简单
Name: String;
Units: String;
Total: Single;
Maint: Single;
Preg: Single;
Lact: Single;
Gain: Single;
Reserves: Single;
end;

var
EvalFactor: array[1..6] of EvalType;

procedure DietEvalOneComputations;
var
x: integer;
begin
if AnimalType <> 'Replacement Heifer' then
begin
EvalFactor[1].Name := 'NE Supplied';
EvalFactor[2].Name := 'NE Required';
EvalFactor[3].Name := 'NE (Diet - Req.)';
EvalFactor[4].Name := 'MP Diet';
EvalFactor[5].Name := 'MP Required';
EvalFactor[6].Name := 'MP (Diet - Req.)';
end
else
begin
EvalFactor[1].Name := 'ME Supplied';
EvalFactor[2].Name := 'ME Required';
EvalFactor[3].Name := 'ME (Diet - Req.)';
EvalFactor[4].Name := 'MP Diet';
EvalFactor[5].Name := 'MP Required';
EvalFactor[6].Name := 'MP (Diet - Req.)';
end;

for x:= 1 to 6 do
begin
if x < 4 then
EvalFactor[x].Units := 'Mcal/day'
else
EvalFactor[x].Units := 'g/day';
end;

if AnimalType <> 'Replacement Heifer' then
EvalFactor[1].Total := NEI_Total
else
EvalFactor[1].Total := MEng_Total;

EvalFactor[1].Maint := EvalFactor[1].Total;

if AnimalType <> 'Replacement Heifer' then
EvalFactor[2].Maint := NEMaint
else
begin
if NEmOverMEng > 0 then
EvalFactor[2].Maint := NEMaint / NEmOverMEng
else
EvalFactor[2].Maint := 0;
end;
end;

//如楼上所说,建议楼主以后求代码多少给点分数,不然真不太有人愿意写
追问
有分,昨天提问不了。我会追加分的
mit1208
2012-02-01 · TA获得超过2347个赞
知道大有可为答主
回答量:2743
采纳率:0%
帮助的人:1865万
展开全部
就是一些基础语法的转换,楼主看下delphi和vb的数据类型有那些不同之处就可以了!
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
lian21ru
2012-02-01 · 超过27用户采纳过TA的回答
知道答主
回答量:110
采纳率:0%
帮助的人:59.9万
展开全部
楼主 太抠门了 求代码的帖子都不给分。。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式