delphi4arab منتديات دلفي للعرب
التحدي الشبه مستحيل - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : تمارين دلفي وحلول (https://delphi4arab.net/forum/forumdisplay.php?fid=16)
+--- الموضوع : التحدي الشبه مستحيل (/showthread.php?tid=9304)



التحدي الشبه مستحيل - chamsderreche - 06-04-2018

السلام عليكم ،
يجب عليكم لحل التمرين صنع برنامج يقوم بحل المعادلات من الدرجة الأولى والثانية حسب اختيار المستخدم ، شرط أن يحل المعادلات من الدرجة الثانية حتى و لو كانت الحلول في مجموعة الأعداد العقدية أو المركبة C ،مثل الملف المرفق
والله ولي التوفيق

آسف نسيت ، مدة التمرين يوم واحد


RE: التحدي الشبه مستحيل - chamsderreche - 07-04-2018

الخدعة هي أني أدخلت القانون هكذا
PHP كود :
procedure TForm3.Button1Click(Sender: TObject);
 var 
a,b,c,d,x1,x2 : real;
begin
    resultat
.Text := '';
 
   a := strtofloat(edit1.text);
 
   b := strtofloat(edit2.text);
 
   c := strtofloat(edit3.text);
 
   d := power(b,2) - 4*a*c;

 
   x1 := -b/(2*a);
 
   if d>=0 then
    begin
      x2 
:= sqrt(d)/(2*a);
 
    resultat.Lines.Add('d=' + floattostr(d));
 
   if d>0 then
    begin
    resultat
.Lines.Add('x1=' + floattostr(x1 - x2));
 
   resultat.Lines.Add('x2=' + floattostr(x1 + x2));
 
   end;
 
   if d=0 then
    begin
    resultat
.Lines.Add('x=' + floattostr(x1));
 
   end;
 
   end;
 
   if(d<0) then
    begin
    x2 
:= sqrt(-d)/(2*a);
 
   resultat.Lines.Add('d=' + floattostr(d));
 
   resultat.Lines.Add('x1=' + floattostr(x1) + '-' + floattostr(x2) + 'i');
 
   resultat.Lines.Add('x2=' + floattostr(x1) + '+' + floattostr(x2) + 'i')
 
   end; 
 فعرفته على شكل نص لا على شكل عدد مركب