当前位置:编程学习 > C#/ASP.NET >>

请教个语法问题

var
  str:PChar;

begin

  str:='17.2';
  if StrLComp(PChar(Edit3.text),str,5)=0 then
  a:=18; z:=30;

  str:='21.3';
  if StrLComp(PChar(Edit3.text),str,5)=0 then
  a:=22.5; z:=35;

  Edit23.Text:=FloatToStr(a);
  Edit24.Text:=FloatToStr(z);
帮我看看 语法有什么问题  为什么EDIT24反馈的值一直是最后一行的Z=35
我列一百行的话 Z值也是一直取最后一行的Z   而A值就能正常取 --------------------编程问答--------------------   if StrLComp(PChar(Edit3.text),str,5)=0 then
  begin
  a:=22.5; z:=35;
  end;

你有两条语句,晕。 --------------------编程问答-------------------- if StrLComp(PChar(Edit3.text),str,5)=0 then
begin  a:=22.5; z:=35;
end; --------------------编程问答-------------------- 谢谢了不过  加了之后 还是总返回最后一行的,我重新编辑了个帖子 ,麻烦看看http://topic.csdn.net/u/20121002/08/fd050e25-8efb-4867-ab88-fed39523de6f.html?78496 --------------------编程问答-------------------- if then
要和begin end括起来 --------------------编程问答--------------------   if StrLComp(PChar(Edit3.text),str,5)=0 then
  a:=18; z:=30;

 a和z都赋值了
那就得用begin end;包起来
  if StrLComp(PChar(Edit3.text),str,5)=0 then
  begin
    a:=18; z:=30;
  end; --------------------编程问答-------------------- --------------------编程问答-------------------- begin end;相当于大括号{}
补充:.NET技术 ,  其他语言
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,