This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROGRAM sumIntegers | |
| IMPLICIT NONE | |
| ! Programmer: Nate Benes | |
| ! Purpose: Sums the integers from 1 to 100 | |
| INTEGER :: i ! For the DO Loop | |
| INTEGER :: total ! To keep a running total | |
| ! Initialize our counter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROGRAM example5 | |
| IMPLICIT NONE | |
| REAL,DIMENSION(5):: v1, v2 | |
| REAL :: dot | |
| INTEGER :: i | |
| dot = 0 | |
| WRITE(*,*) 'Enter the first dataset:' | |
| READ (*,*) v1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROGRAM example4 | |
| IMPLICIT NONE | |
| INTEGER :: input | |
| INTEGER :: mod_out | |
| ! start program | |
| DO | |
| WRITE(*,*) "Please enter an integer" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROGRAM example3 | |
| IMPLICIT NONE | |
| INTEGER::in1, in2, sum, diff | |
| 110 FORMAT('Enter two three-digit integers') | |
| WRITE(*,100) | |
| WRITE(*,110) | |
| READ(*,250) in1,in2 | |
| 250 FORMAT(2I3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROGRAM example2 | |
| IMPLICIT NONE | |
| INTEGER :: n | |
| INTEGER :: nMinusOne | |
| INTEGER :: runningTotal | |
| INTEGER :: out | |
| LOGICAL :: skiploop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SUBROUTINE example1(messyarray, usefulLength, cleanarray) | |
| IMPLICIT NONE | |
| CHARACTER (LEN=12), DIMENSION(*), INTENT(IN) :: messyarray | |
| CHARACTER (LEN=12), DIMENSION(*), INTENT(OUT) :: cleanarray | |
| INTEGER, INTENT(IN) :: usefulLength | |
| CHARACTER (LEN=12) :: swap, caps1, caps2 | |
| INTEGER :: i,j,k,l,m, len1, len2, percent | |
| DO i=1, usefulLength |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SUBROUTINE example1(messyarray, usefulLength, cleanarray) | |
| IMPLICIT NONE | |
| CHARACTER (LEN=12), DIMENSION(*), INTENT(IN) :: messyarray | |
| CHARACTER (LEN=12), DIMENSION(*), INTENT(OUT) :: cleanarray | |
| INTEGER, INTENT(IN) :: usefulLength | |
| CHARACTER (LEN=12) :: swap, caps1, caps2 | |
| INTEGER :: i,j,k,l,m, len1, len2, percent | |
| DO i=1, usefulLength |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MODULE circleFunctions | |
| CONTAINS | |
| SUBROUTINE circle(x, y) | |
| REAL (KIND=8), INTENT(IN) :: x | |
| REAL (KIND=8), INTENT(OUT) :: y | |
| IF (x**2 < 1) THEN | |
| y = sqrt(1-x**2) | |
| ELSE | |
| y = 0 | |
| END IF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| MODULE globalConfig | |
| SAVE | |
| ! Project: Twitter.f90 | |
| ! Author: Nate Benes | |
| ! File: config.f90 | |
| ! Desc: A module to store things that need to be globally available | |
| ! Change these to suit your needs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INTEGER :: readErr, myVar | |
| ! some code | |
| READ (*,*,IOSTAT=readErr) myVar | |
| IF (readErr /= 0) THEN | |
| ! They are stupid, make them do it again | |
| ELSE | |
| ! User did their job | |
| END IF |