Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
ALGOL
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
====ALGOL 68==== The following code samples are ALGOL 68 versions of the above ALGOL 60 code samples. ALGOL 68 implementations used ALGOL 60's approaches to [[stropping (programming)|stropping]]. In ALGOL 68's case tokens with the bold typeface are reserved words, types (modes) or operators. '''proc''' abs max = ([,]'''real''' a, '''ref''' '''real''' y, '''ref''' '''int''' i, k)'''real''': '''comment''' The absolute greatest element of the matrix a, of size βa by 2βa is transferred to y, and the subscripts of this element to i and k; '''comment''' '''begin''' '''real''' y := 0; i := βa; k := 2βa; '''for''' p '''from''' βa '''to''' βa '''do''' '''for''' q '''from''' 2βa '''to''' 2βa '''do''' '''if''' '''abs''' a[p, q] > y '''then''' y := '''abs''' a[p, q]; i := p; k := q '''fi''' '''od''' '''od'''; y '''end''' # abs max # Note: lower (β) and upper (β) bounds of an array, and array slicing, are directly available to the programmer. floating point algol68 test: ( '''real''' a,b,c,d; # ''printf'' β sends output to the '''file''' ''stand out''. # # ''printf($p$);'' β selects a ''new page'' # printf(($pg$,"Enter d:")); read(d); '''for''' step '''from''' 0 '''while''' a:=step*d; a <= 2*pi '''do''' printf($l$); # ''$l$'' - selects a ''new line''. # b := sin(a); c := cos(a); printf(($z-d.6d$,a,b,c)) # formats output with 1 digit before and 6 after the decimal point. # '''od''' )
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)