12.12.2007, 17:09
|
Прохожий
|
|
Регистрация: 12.12.2007
Сообщения: 1
Репутация: 10
|
|
Проверка Edit подскажите...
ребят помогите, суть в том, что нужно для Edit'ов сделать проверку, не ввели ли случайно символы вместо цифр, причем только с помощью Val(таково требование препода). Как ни пробовал не получается.
Цитата:
procedure TForm1.N8Click(Sender: TObject);
const a=0.44;
b=2.28;
var x,l,x1,x2,d:real;
y:real;
f:textfile;
s1,:string;
begin
If Edit1.Text <> '' then x1:=strtofloat(Edit1.Text);
if Edit2.Text <> '' then x2:=strtofloat(Edit2.Text);
if Edit3.Text <> '' then d:=strtofloat(Edit3.Text)
else
l:=messagedlg('ошибка',mterror,[mbOk],0);
x:=x1;
while x<=x2 do
if checkbox2.Checked then begin assignfile(f,'text.txt');
rewrite(f);end;
s1:=' x'+' '+'f(x)';
memo1.Lines.Add(' x'+' '+'f(x)');
begin
begin
y:=a*sqr(sin(x/2)/cos(x/2))/(b+0.7*x);
s1:=floattostr(x)+' '+floattostrf(y,fffixed,10,5);
if CheckBox1.checked then
memo1.LineS.add(s1);
if checkbox2.checked then
writeln(f,s1);
if checkbox3.checked then
series1.addxy(x,y,'',clred);
end;
x:=x+d;
end;
end;
|
|