فورتران

فورتران (بالإنجليزية: Fortran) هي لغة برمجة متعددة الاستخدام واختصار لكلمتين في الإنجليزية معناها ترجمة المعادلات (FORmula TRANslation)في عام 1954 خرج جون باكوس John Backus مع مجموعة من شركة IBM بلغة الفورتران وكانت أولي لغات البرمجة ذوات المستوى العالي وتستخدم أساسا في التحليلات العددية وفي الحوسبة العلمية.وتتميز هذه اللغة بالبساطة والإيجاز ولقد ظهرت العديد من صور تلك اللغة آخرها Fortran 2003. تحتوي آخر إصدارات للغة الفورتران علي مجموعة من الأوامر التي تفسر نفسها بنفسها مثل أقرأ READ وأكتب WRITE وإذهب إلي GO TO وتوقف STOP وتنفذ برامج الفورتران تبعا لتسلسل الجمل بها. ولكن تكمن صعوبتها في تحديد الخطأ عند حدوثه حيث من يستوجب عليك تتبع الكود من اوله مما يزيد الامر صعوبة.

أمثلة برمجية

البرنامج التالي يحسب قيمة المتوسط للبيانات التي تمت إدخالها: <source lang="fortran"> program average

 ! Read in some numbers and take the average
 ! As written, if there are no data points, an average of zero is returned
 ! While this may not be desired behavior, it keeps this example simple
 implicit none
 real, dimension(:), allocatable :: points
 integer                         :: number_of_points
 real                            :: average_points=0., positive_average=0., negative_average=0.
 write (*,*) "Input number of points to average:"
 read  (*,*) number_of_points
 allocate (points(number_of_points))
 write (*,*) "Enter the points to average:"
 read  (*,*) points
 ! Take the average by summing points and dividing by number_of_points
 if (number_of_points > 0) average_points = sum(points) / number_of_points
 ! Now form average over positive and negative points only
 if (count(points > 0.) > 0) then
    positive_average = sum(points, points > 0.) / count(points > 0.)
 end if
 if (count(points < 0.) > 0) then
    negative_average = sum(points, points < 0.) / count(points < 0.)
 end if
 deallocate (points)
 ! Print result to terminal
 write (*,'(a,g12.4)') 'Average = ', average_points
 write (*,'(a,g12.4)') 'Average of positive points = ', positive_average
 write (*,'(a,g12.4)') 'Average of negative points = ', negative_average

end program average </source>

أنظر أيضاً

وصلات خارجية

be:FORTRAN bg:FORTRAN bn:ফোরট্রান bs:FORTRAN ca:Fortran ckb:فۆڕتران cs:Fortran cv:Фортран da:Fortran de:Fortran el:Fortran Fortran]] eo:Fortran (programlingvo) es:Fortran et:Fortran fa:فورترن fi:Fortran fr:Fortran ga:FORTRAN he:FORTRAN hi:फ़ोरट्रान hr:Fortran hu:Fortran ia:FORTRAN id:Fortran it:Fortran ja:FORTRAN kab:Fortran ko:포트란 ku:Fortran lt:Fortran lv:Fortran mr:फोर्ट्रान ms:FORTRAN my:Fortran nl:Fortran nn:Fortran no:Fortran pl:Fortran pt:Fortran ro:Fortran ru:Фортран sah:Fortran sh:Fortran simple:Fortran sk:Fortran sl:Fortran sq:Fortran sr:Фортран sv:Fortran ta:போர்ட்ரான் te:ఫోర్ట్రాన్ tg:Фортран th:ภาษาฟอร์แทรน tr:FORTRAN uk:Fortran vi:Fortran zh:Fortran