الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

problem in TP7

مغلق
بدأه geo في 6 يونيو 2004 · 3 رد · 621 مشاهدة · في لغة Delphi
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

Al-salam alekom..

sorry I couldnot write it in arabic.

I was given a samll program in turbo pascal 7, with the following text:

 Program Banks;
  {uses wincrt;}
  var num,n,year: integer;
      name :string[30];
      k,kn,rate,i:real;

Begin
writeln ('account number   ',num);
readln (num);

     begin

         repeat
              writeln('inter name of client', name);
              readln(name);
              writeln('inter value of deposite  ', k);
              readln(k);
               n:=0;
               repeat

                     if k<=50000 then i:=0.08
                     else i:= 0.09;

                    repeat

                      n:=n+1;
                      kn:= k*EXP(n*ln(1+i));
                      rate:=kn-k;
                    until (kn>=2*k);
                     year:=1995+n;

                     writeln ('account number: ',num);
                     writeln ('client name: ',name);
                     writeln ('deposite money= ',k:5:1);
                     writeln ('exact amount of money in the account ',kn:5:1);
                     writeln ('rate= ',rate:5:1);
                     writeln ('enter next account number');
                     readln(num);

               until(num<0);

   until(name = exit);

              writeln;
              readln;
  end;
end.

we have here 3 (repeat,until) loops, the first (repeat) dont have its own (until),

so I typed the following :

until(name=exit);

so the compiler gives an erorr, any suggestion to solve the problem.

when Disabling the first(repeat) the program only runs for 1 correct time, and after the command writeln('enter next account number');

it will mix everything.

any help plz.

تم تعديل هذه المشاركة بواسطة HGB في 6 يونيو 2004 في 19:45

#2

السلام عليكم

To avoid this problem I think that the best thing you have to do is to add (begin and end) to every REPEAT Loop .. So the Compiler can understand every (REPEAT) Block .. and I know that (Repeat) Loop doesn't need Begin and end but when you write a repeat loop in another one the compiler will not know any loop or any block is working on in atime .

I hope that this idea will solve your problem . and if not i will help.

#3

thnak u Nova

I found the problem, It was in the following line

until(name = exit);

It should be :

until(name = 'exit');

I dont know may be I was blinded couldnot notice the error.

thank u at least for replying.

تم تعديل هذه المشاركة بواسطة geo في 14 يونيو 2004 في 12:08

#4

Don't care

You know everything in Pascal is possible ..

I say everything you want in TPascal ask me for it and I will

be so pleased to help .

هذا الموضوع مغلق.

مواضيع مشابهة