diff options
author | Wu Cheng-Han | 2015-05-04 15:53:29 +0800 |
---|---|---|
committer | Wu Cheng-Han | 2015-05-04 15:53:29 +0800 |
commit | 4b0ca55eb79e963523eb6c8197825e9e8ae904e2 (patch) | |
tree | 574f3923af77b37b41dbf1b00bcd7827ef724a28 /public/vendor/codemirror/mode/fortran/index.html | |
parent | 61eb11d23c65c9e5c493c67d055f785cbec139e2 (diff) |
First commit, version 0.2.7
Diffstat (limited to 'public/vendor/codemirror/mode/fortran/index.html')
-rwxr-xr-x | public/vendor/codemirror/mode/fortran/index.html | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/public/vendor/codemirror/mode/fortran/index.html b/public/vendor/codemirror/mode/fortran/index.html new file mode 100755 index 00000000..102e8f82 --- /dev/null +++ b/public/vendor/codemirror/mode/fortran/index.html @@ -0,0 +1,81 @@ +<!doctype html> + +<title>CodeMirror: Fortran mode</title> +<meta charset="utf-8"/> +<link rel=stylesheet href="../../doc/docs.css"> + +<link rel="stylesheet" href="../../lib/codemirror.css"> +<script src="../../lib/codemirror.js"></script> +<script src="fortran.js"></script> +<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> +<div id=nav> + <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> + + <ul> + <li><a href="../../index.html">Home</a> + <li><a href="../../doc/manual.html">Manual</a> + <li><a href="https://github.com/codemirror/codemirror">Code</a> + </ul> + <ul> + <li><a href="../index.html">Language modes</a> + <li><a class=active href="#">Fortran</a> + </ul> +</div> + +<article> +<h2>Fortran mode</h2> + + +<div><textarea id="code" name="code"> +! Example Fortran code + 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 +</textarea></div> + + <script> + var editor = CodeMirror.fromTextArea(document.getElementById("code"), { + lineNumbers: true, + mode: "text/x-fortran" + }); + </script> + + <p><strong>MIME types defined:</strong> <code>text/x-Fortran</code>.</p> + </article> |