לפי מה שהבנתי, התכנית אמורה לקלוט את מספר המכוניות שמשתתפות במירוץ, ואז, עבור כל המכוניות שמשתתפות, לבדוק מי הראשונה ומי השנייה, כאשר ה-Catch הוא שאסור לשמור את הנתונים, כלומר הכל "חי" (ללא מערך או כל מבנה נתונים אחר, שישמור את כל המכוניות, ואחר כך יבצע את החישובים). program race;type car_prop = record place : integer; time : integer; end; var car_n, i, car_time : integer; first, second : car_prop; begin write('Enter the number of cars in the race:'); readln(car_n); for i:= 1 To car_n do begin write('Enter the time of car no'' ', i, ': '); readln(car_time); if (car_time > first.time) then begin first.time = car_time; first.place = i; end else if (car_time > second.time) then begin second.time = car_time; second.place = i; end; end; writeln('Car no'' ', first.place, 'took the first place !'); writeln('Car no'' ', second.place, 'took the second place !'); end.
|
Dudenland