[تمرين] ما الخطأ في هذا الكود
#1
[FONT="Comic Sans MS"][COLOR="Purple"]السلام عليكم
لتنشيط المنتدى شوية بمسابقات و تمارين مفيدة
ما الأخطاء في الكود
PHP كود :
procedure TForm1.Button1Click(Sender: TObject);
var
go : Integer;
begin
go
: 'not found';
IEHTTP1.ExecuteURL(Edit1.Text);
if 
IdHTTP1.Response.ResponseCode =go then
ShowMessage
('File Exist') else
ShowMessage('File Do Not Exist');
end; 

بالتوفيق للجميع[/COLOR]
الرد
#2
الخطا واضح انت عرفت go على انه integer وبعد ذلك
وضعت فيه قيمة من نوع string
الرد
#3
onexite كتب :الخطا واضح انت عرفت go على انه integer وبعد ذلك
وضعت فيه قيمة من نوع string

صح الخطأ الأول

PHP كود :
procedure TForm1.Button1Click(Sender: TObject);
var
go : String;
begin
go
: 'not found';
IEHTTP1.ExecuteURL(Edit1.Text);
if 
IdHTTP1.Response.ResponseCode =go then
ShowMessage
('File Exist') else
ShowMessage('File Do Not Exist');
end; 

و الان الخطأ الثاني ^^
الرد
#4
DAMAX2010 كتب :


و الان الخطأ الثاني ^^

عكس شرط IF

PHP كود :
var
go : String;
begin
go
:= 'not found';
IEHTTP1.ExecuteURL(Edit1.Text);
if 
IdHTTP1.Response.ResponseCode <> go then
ShowMessage
('File Exist') else
ShowMessage('File Do Not Exist');
end; 
أدبني الدهر فأراني نقص عقلي وإذا ما ازددت علما زادني علما بجهلي
الرد
#5
كود :
uses windows; type t_rec = record public procedure ShowMsg(msg : string); procedure init(); msg : string; end; { t_rec } procedure t_rec.init; begin msg := 'Record string'; end; procedure t_rec.ShowMsg(msg: string); begin MessageBox(0,pchar(msg),'h',0); end; var test : t_rec; begin test.init(); test.ShowMsg('Argument String'); end.

بدون تجريب الكود الاجراء showMsg سيضهر Argument String او Record String
الرد
#6
كتبت g: و نسيت = و يفترض أن تكتب g:=
chams derreche
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم