Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG-material-public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Walter, Wolfgang
PROG-material-public
Commits
969b2031
Commit
969b2031
authored
7 years ago
by
Felix Hilsky
Browse files
Options
Downloads
Patches
Plain Diff
variablenbenennung gefixt
parent
d2cef6c7
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
einfuehrung_sub_fun
+10
-10
10 additions, 10 deletions
einfuehrung_sub_fun
with
10 additions
and
10 deletions
einfuehrung_sub_fun
+
10
−
10
View file @
969b2031
...
...
@@ -35,7 +35,7 @@ Nach Ausführung des Unterprogramms soll berechneter (eingegebener) Wert im Haup
Option 1 mit subroutine:“
PROGRAM
SUBROUTINE
namens
eingabe(eingabeaufforderung, benutzereingabe)
SUBROUTINE
anzahl
eingabe(eingabeaufforderung, benutzereingabe)
CHARACTER(len = *), INTENT(IN) :: eingabeaufforderung ! len = * -> übernommene Länge
INTEGER, INTENT(OUT) :: benutzereingabe ! voriger Wert des Arguments wird ignoriert
...
...
@@ -58,15 +58,15 @@ man gibt Argumente rein, bekommt Ergebnis raus
damit kann man weiterrechnen, z.B. mittelwert = REAL(summe)/n (in Zyklus Programm)
Das Ergebnis nennt man "Rückgabewert"“
FUNCTION
namens
eingabe(eingabeaufforderung)
FUNCTION
anzahl
eingabe(eingabeaufforderung)
CHARACTER(len = *), INTENT(IN) :: eingabeaufforderung ! len = * -> übernommene Länge
INTEGER ::
namens
eingabe ! innerhalb der Funktion ist eingabe eine
INTEGER ::
anzahl
eingabe ! innerhalb der Funktion ist eingabe eine
! normal nutzbare Variable, bekommt einen Typ
DO
WRITE(*,*) eingabeaufforderung
READ (*,*)
namens
eingabe
IF (
namens
eingabe > 0) THEN
READ (*,*)
anzahl
eingabe
IF (
anzahl
eingabe > 0) THEN
EXIT
ELSE
WRITE(*,*) "Eingabe fehlerhaft. Bitte nochmal."
...
...
@@ -106,15 +106,15 @@ MODULE simpleIO
CONTAINS
FUNCTION
namens
eingabe(eingabeaufforderung)
FUNCTION
anzahl
eingabe(eingabeaufforderung)
CHARACTER(len = *), INTENT(IN) :: eingabeaufforderung ! len = * -> übernommene Länge
INTEGER, (KIND=intkind) ::
namens
eingabe ! innerhalb der Funktion ist eingabe eine
INTEGER, (KIND=intkind) ::
anzahl
eingabe ! innerhalb der Funktion ist
anzahl
eingabe eine
! normal nutzbare Variable, bekommt einen Typ
DO
WRITE(*,*) eingabeaufforderung
READ (*,*)
namens
eingabe
IF (eingabe > 0) THEN
READ (*,*)
anzahl
eingabe
IF (
anzahl
eingabe > 0) THEN
EXIT
ELSE
WRITE(*,*) "Eingabe fehlerhaft. Bitte nochmal."
...
...
@@ -132,7 +132,7 @@ PROGRAM testprog
INTEGER :: n
n = eingabe("Hallo, gib eine Zahl ein.")
n =
anzahl
eingabe("Hallo, gib eine Zahl ein.")
END PROGRAM
„beim Kompilieren muss beides kompiliert werden, das Modul allerdings
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment