Fórum O que há de errado com esse código? #354585
29/02/2008
0
var
v1,v2,v3:integer;
begin
v1:=strtoint(edit1.text);
v2:=strtoint(edit2.text);
v3:=strtoint(edit3.text);
if radiogroup1.itemindex = 0 then
begin
if (v1>v2) and (v2>v3) then
begin
memo1.lines.add(inttostr(v1));
memo1.lines.add(inttostr(v2));
memo1.lines.add(inttostr(v3));
end;
end;
if radiogroup1.ItemIndex = 1 then
begin
if (v1>v2) and (v2>v3) then
begin
memo1.Lines.Add(inttostr(v3));
memo1.lines.add(inttostr(v2));
memo1.lines.add(inttostr(v1));
end;
end;
if radiogroup1.ItemIndex = 2 then
begin
if (v1>v2) and (v2>v3) then
begin
memo1.lines.add(inttostr(v1));
end;
end;
end;
end.
Danilo_ovão
Curtir tópico
+ 0Posts
29/02/2008
Edilcimar
Gostei + 0
29/02/2008
Jpauloss
var
v1,v2,v3:integer;
begin
v1:=strtoint(edit1.text);
v2:=strtoint(edit2.text);
v3:=strtoint(edit3.text);
if radiogroup1.itemindex = 0 then
begin
if (v1>v2) and (v2>v3) then
begin
memo1.lines.add(inttostr(v1));
memo1.lines.add(inttostr(v2));
memo1.lines.add(inttostr(v3));
end;
end;
if radiogroup1.ItemIndex = 1 then
begin
if (v1>v2) and (v2>v3) then
begin
memo1.Lines.Add(inttostr(v3));
memo1.lines.add(inttostr(v2));
memo1.lines.add(inttostr(v1));
end;
end;
if radiogroup1.ItemIndex = 2 then
begin
if (v1>v2) and (v2>v3) then
begin
memo1.lines.add(inttostr(v1));
end;
end;
end;
end.[/quote:b5163dc6a6]
Aparentemente nenhum, da algum erro?
Gostei + 0
29/02/2008
Facc
Gostei + 0
29/02/2008
Onjahyr
Gostei + 0
29/02/2008
Danilo_ovão
Gostei + 0
29/02/2008
Edilcimar
Gostei + 0
29/02/2008
Onjahyr
- Nos TEdits tem que haver números (nada de letras nem frações);
- Nada de pontos ou vírgulas;
- Se o RadioGroup1 estiver checado:
> Edit1 tem que ter um número maior que o Edit2, e o Edit2 também deve ser maior que Edit3....
E quanto ao cálculo, você não está fazendo nenhum no código. Apénas está pedindo para acrescentar o conteúdo das variáveis no TMemo.
Para somar você tem que fazer assim:
[b:1fe3c23c6e]memo1.lines.add(inttostr(v1+v2+v3));[/b:1fe3c23c6e]
Gostei + 0
29/02/2008
Danilo_ovão
Gostei + 0
29/02/2008
Onjahyr
para deixar o maior número neste componente, ele tem uma opção no object inspector para isso...
Gostei + 0
29/02/2008
Onjahyr
Opa! Desculpe, vc está usando TMemo... Use ListBox que tem esta opção no ObjectInspector...
Gostei + 0
01/03/2008
Danilo_ovão
Gostei + 0
01/03/2008
Marco Salles
Faça um codigo Correto para a função ....O seu codigo esta muito esquisito
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)