AEROSPAC ENG PROBLM
AEROSPAC ENG PROBLM AER E 160
Popular in Course
Popular in Aerospace Engineering
This 2 page Class Notes was uploaded by Noel Koelpin on Sunday September 27, 2015. The Class Notes belongs to AER E 160 at Iowa State University taught by Dana Haugli in Fall. Since its upload, it has received 46 views. For similar materials see /class/214529/aer-e-160-iowa-state-university in Aerospace Engineering at Iowa State University.
Reviews for AEROSPAC ENG PROBLM
Report this Material
What is Karma?
Karma is the currency of StudySoup.
Date Created: 09/27/15
Main Programs The essential structure of a FORTRAN program with no explicit subroutines or functions is PROGRAM ltinsert name of programgt ltInsert IMPLICIT NONE statement and declarationsgt ltInsert executable statements followed by STOPgt END PROGRAM ltinsert name of programgt Every program must begin with the PROGRAM line and end with END PROGRAM Program names must begin with a letter and may contain any combination of letters numbers and underscore characters after the rst letter No other characters are allowed Programs are saved in text les The text les must be named with the extension f90 such as main 90 The name of the text le can be different from the name on the PROGRAM line Variables are declared immediately after the PROGRAM line including the line IMPLI CIT NONE which must listed before data type declarations such as REAL CHARACTER or INTEGER Executable statements follow the declarations and end with the line STOP STOP tells the program to stop running Case e g small or capital letters does not matter in writing a FORTRAN program Each programmer develops their own style and many use case to clarify their codes For example this instructor uses capital letters for FORTRAN commands and lower case letters for program and variable names Good programmers add comments to their codes that explain what the code is doing Words and sentences that follow an exclamation point are comments The compiler ignores them Several examples of main programs follow Example 1 The Hello World program below is a traditional introduction to the form of a main program PROGRAM hello WRITE quotHello Worldquot END PROGRAM hello This program has no declarations The statement WRITE quotHello World quot is an executable statement and causes the words quotHello Worldquot to appear on the screen when the program runs Example 2 A program to add two numbers and save them in the variable quotcquot follows PROGRAM add Declarations IMPLICIT NONE INTEGER a b c Executable Statements STOP END PROGRAM add The statements IMPLICIT NONE INTEGER a b c are examples of declarations IMPLI CIT NONE means that variables are quotexplicitlyquot declared and the compiler must not assume a data type based on the name of a variable For more information on declaring variables see the related documents under quotData Storagequot on the Aer E 160 homepage The executable statements first assign the value 1 to a then 2 to b then the sum ab to c The value of c is 3 after this operation and unde ned before The WRITE statement produces the following output on the screen These operations and others are described in several different documents on the Aer E 160 homepage For the structure of a FORTRAN program with subroutines functions and or modules see the corresponding documents under quotProgram Structuresquot on the Aer E 160 webpage