I'm trying to make a blood pressure category checker in Delphi 7, and I just got to know Delphi for a few weeks. The problem is every time I put numbers above than 120, the label caption always displaying normal. Here is my code :
procedure TForm1.Button1Click(Sender: TObject);
var a,b:real;
begin
a:=strtofloat(edit1.Text);
if (a<120) then label1.caption:='optimal'
else if (a>120) then label1.caption:='normal'
else if (a<130) then label1.caption:='normal'
else if (a>130) then label1.caption:='normal high'
else if (a<140) then label1.caption:='normal high'
else if (a>140) then label1.caption:='grade 1 hypertension'
else if (a<160) then label1.caption:='grade 1 hypertension'
else if (a>160) then label1.caption:='grade 2 hypertension'
else if (a<180) then label1.caption:='grade 2 hypertension'
else if (a>181) then label1.caption:='grade 3 hypertension'
end;
end.
It may be some common mistake but I still can't figure it out myself, any kind of help would help a lot, thank you.
Aucun commentaire:
Enregistrer un commentaire