[ERRO] Programa IMC, Pressão Arterial, Peso Ideal e Frequência Cardíaca ( DELHPI 7)
If ((RadioGroup2.ItemIndex=0) and ((i>=18) and (i<=25)) and ((fc>=49) and (fc<=55))) then
rfc:= (Excelente);
_____________________________________________________________________________________________
ERROR: Incompatible types: Real and String
i = idade / fc = frequência cardíaca / rfc = Frequência Cardíaca em Repouso / RadioGroup2 = 0 é Masculino e 1 é Feminino.
PS: Declarei as varáveis certas e já conerti certo tbm.
Aguardo uma resposta, obrigado!
rfc:= (Excelente);
_____________________________________________________________________________________________
ERROR: Incompatible types: Real and String
i = idade / fc = frequência cardíaca / rfc = Frequência Cardíaca em Repouso / RadioGroup2 = 0 é Masculino e 1 é Feminino.
PS: Declarei as varáveis certas e já conerti certo tbm.
Aguardo uma resposta, obrigado!
Lucas Gabriel
Curtidas 0
Respostas
Bruno Leandro
19/05/2012
me parece que a variavel rfc é do tipo real e esta sendo atribuido a ela um valor string
GOSTEI 0
Lucas Gabriel
19/05/2012
Olha aí:
procedure TForm1.Button1Click(Sender: TObject);
var peso, alt, vlrIMC, pimi, pima, fc,i, rfc: real;
indice: integer;
begin
try
peso := StrToFloat(Edit1.Text);
alt := StrToFloat(Edit2.Text);
vlrIMC := IMC(peso, alt);
indice := faixaIMC(vlrIMC);
pimi:= 18*(alt*alt);
pima:= 25*(alt*alt);
Edit5.Text:= FloatToStr (i);
Edit12.Text:= FloatToStr (fc);
Edit11.Text:= FloatToStr (rfc);
Edit3.Text := formatfloat(##.0,vlrIMC);
//Edit3.Text := FloatToStr(vlrIMC);
Edit9.Text := formatfloat(##.0,pimi);
//Edit9.Text:= FloatToStr (pimi);
Edit10.Text := formatfloat(##.0,pima);
//Edit10.Text:= FloatToStr (pima);
corResultado(indice, Form1);
If ((RadioGroup2.ItemIndex=0) and ((i>=18) and (i<=25)) and ((fc>=49) and (fc<=55))) then
rfc:= (Excelente);
except
end;
end;
end.
procedure TForm1.Button1Click(Sender: TObject);
var peso, alt, vlrIMC, pimi, pima, fc,i, rfc: real;
indice: integer;
begin
try
peso := StrToFloat(Edit1.Text);
alt := StrToFloat(Edit2.Text);
vlrIMC := IMC(peso, alt);
indice := faixaIMC(vlrIMC);
pimi:= 18*(alt*alt);
pima:= 25*(alt*alt);
Edit5.Text:= FloatToStr (i);
Edit12.Text:= FloatToStr (fc);
Edit11.Text:= FloatToStr (rfc);
Edit3.Text := formatfloat(##.0,vlrIMC);
//Edit3.Text := FloatToStr(vlrIMC);
Edit9.Text := formatfloat(##.0,pimi);
//Edit9.Text:= FloatToStr (pimi);
Edit10.Text := formatfloat(##.0,pima);
//Edit10.Text:= FloatToStr (pima);
corResultado(indice, Form1);
If ((RadioGroup2.ItemIndex=0) and ((i>=18) and (i<=25)) and ((fc>=49) and (fc<=55))) then
rfc:= (Excelente);
except
end;
end;
end.
GOSTEI 0
Bruno Leandro
19/05/2012
If ((RadioGroup2.ItemIndex=0) and ((i>=18) and (i<=25)) and ((fc>=49) and (fc<=55))) then
rfc:= (Excelente);
neste ponto do codigo esta gerando o erro pois a variavel rfc é do tipo real, ou seja voce pode atribuir valores numericos com casas decimais ou não
rfc pode receber
rfc := 1;
rfc := 2.00;
mas uma mensagem como o que ocorre NÃO é aceito(rfc:= (Excelente)).
rfc:= (Excelente);
neste ponto do codigo esta gerando o erro pois a variavel rfc é do tipo real, ou seja voce pode atribuir valores numericos com casas decimais ou não
rfc pode receber
rfc := 1;
rfc := 2.00;
mas uma mensagem como o que ocorre NÃO é aceito(rfc:= (Excelente)).
GOSTEI 0