פסקל ומחסנית...

gabrielr

New member
פסקל ומחסנית...

אני אמור לפתור בעייה שנתנו לי לקחת 2 מחסניות שכתוב בהם מספרים (למעלה מספר אחדות, מתחתיו עשרות וכו´), ולחבר את 2 המחסניות למחסנית אחת כתבתי את התשובה הבאה, אך המחשב שלי נתקע כשאני מבצע אותה Procedure arrange(st1,st2:stack_type; var st3:stack_type); var sta,stb:stack_type; x,n,temp,rem:integer; Begin temp:=0; rem:=0; while not ((stack_empty(st1)) and (stack_empty(st2))) do begin if rem>0 then temp:=1 else temp:=0; rem:=0; stack_pop(st1,x); stack_pop(st2,n); temp:=temp+x+n; if temp>9 then begin temp:=temp-10; rem:=1; end; stack_push(st3,temp); end; End; אני מנסה להבין איפה הבאג שלי, אבל הכל נראה לי תקין בבקשה תעזרו לי תודה
 
למעלה