Programovaci jazyk Pascal byl vytvoren v roce 1971. Za jeho
vznikem stal Niklaus Wirth, profesor polytechniky v Zurichu. Pascal
vznikl jako zjednodusena verze jineho znameho programovaciho jazyka
z sedesatych let - Algolu a byl navrzen hlavne pro vyuku
programovani. V dobe vzniku Pascalu samozrejme existovala velka
rada programovacich jazyku, nektere z nich byly velmi rozsirene.
Klicovou myslenkou tohoto noveho jazyka bylo zavedeni prisneho
poradku, vynuceneho koncepci datovych typu, pozadovanych deklaraci
dat a strukturovanym programovanim. Prave to melo mimo jine pomoci
studentum pri pronikani do taju programovani.
Turbo Pascal
O slavu jazyka Pascal se zcela urcite nejvice zaslouzila firma
Borland. Jeji svetoznamy prekladac, zvany Turbo Pascal, ktery byl
urcen pro osobni pocitace kompatibilni s IBM, spatril svetlo sveta
v roce 1983. Diky svym inovativnim konceptum, jednoduchosti a
rychlosti byl Turbo Pascal jeden cas nejprodavanejsim prekladacem
na svete.
V Turbo Pascalu se poprve objevilo
integrovane vyvojove prostredi (Integrated Development
Environment, zkratka IDE), ve kterem bylo mozno editovat
zdrojovy kod, spoustet prekladac, zjistit chyby, a ty primo na
prislusnem radku opravit. Dnes to zni docela trivialne, ale
tehdy to byla naprosta bomba. Predtim bylo totiz nutno ukoncit
editor, vratit se do operacniho systemu, spustit na prikazovem
radku prekladac, opsat si chyby a cele kolo znova
opakovat.
Agresivni byla i cenova politika - Turbo Pascal stal tehdy 49
dolaru, zatimco konkurencni prekladac od Microsoft nekolik set.
Uspech Turbo Pascalu vedl k tomu, ze Microsoft prestal pascalsky
prekladac dale vyvijet a prodavat. Po deviti uspecnych verzich
Turbo Pascalu vyvinula firma Borland visualni programovaci jazyk
Delphi, ktery z Pascalu vychazi a v mnoha smerech jej dale
rozsiruje. A i kdyz ma sve dosud nejvetsi uspechy za sebou, stale
je platforma Delphi velmi rozsirena a dodnes pouzivana.
Pojidaci kolacu
Nove programovaci jazyky zjednodusovaly programovani a rozsirovaly
pocet lidi, kteri se psanim programu zabyvali. Na druhou stranu
vzbuzovaly pobaveni a posmech opravdovych klasickych
programatoru. Proto vznikl (shodou okolnosti v roce 1983, tedy v
roce, kdy se objevil Turbo Pascal) i puvabny pamflet, nazvany
Opravdovi programatori nepouzivaji Pascal,
ktery rozhodne i dnes stoji za precteni
.
Cache
A ted uz k nasi uloze - ceske zastoupeni firmy Borland sidlilo
kdysi v centru, dnes je umisteno v jednom ze starsich domu pod
Vysehradem. Keska lezi nedaleko a k ziskani jejich souradnic Vas
dovede nasledujici kratky program, napsany v Turbo Pascalu. Ten
pouziva jednu z oblibenych uloh - trideni. Zvolil jsem rekurzivni
Quick Sort ale nebojte se, program je opravdu jednoduchy. Pro
spravnou interpretaci jeho vysledku vam muze pomoci ciferny soucet
dne a mesice, ve kterem byla v roce 1983 vypustena uplne prvni
verze programu Turbo Pascal. Rad bych Vas poprosil - nez se
pustite do shaneni vyse zmineneho programu, zkuste se na chvilku
zamyslet, co se tak muze odehravat v poslednich deviti radkach
programu. Mozna, ze zjistite, ze je to tak jednoduche, ze prekladac
ani nebudete potrebovat!
program CC6; (* Computer Cache #6 coordinates *)
uses crt;
const maxR = 6;
maxC = 10;
pole : array [1 .. maxR*maxC] of integer = (
055,040,010,020,070,060,
050,080,065,075,009,008,
000,007,006,001,003,002,
005,004,920,820,510,790,
410,840,370,770,950,810,
020,018,011,013,015,014,
019,016,017,012,055,035,
030,050,010,020,015,025,
045,040,572,698,723,359,
207,942,811,420,789,417);
var a : array [1..maxR*maxC] of integer;
n,x,y : integer;
procedure print (s1,s2:integer);
var j : integer;
begin
for j:=s1 to s2 do write (' ',a[j] :3); writeln;
end;
procedure selectdata (s1,s2: integer);
var j : integer;
begin
for j:= s1 to s2 do a[j]:=pole[j];
end;
procedure quicksort (L,R :integer);
var j,k : integer;
t,v : integer;
begin
if L < R then
begin
v:=a[R];
j:=L-1;
k:=R;
repeat
repeat j:=j+1 until ( a[j] >= v );
repeat k:=k-1 until ( (a[k] <= v) OR (k = 1) );
t:=a[j]; a[j]:=a[k]; a[k]:=t;
until k<=j;
a[k]:=a[j];
a[j]:=a[R];
a[R]:=t;
quicksort(L,j-1);
quicksort(j+1,R);
end;
end;
begin
for n:=1 to maxR do begin
x:=maxC*(n-1)+1;
y:=maxC*n;
selectdata (x,y);
quicksort (x,y);
print (x,y);
end;
end.
Hodne stesti pri programovani i hledani! V logu setrete mistem -
staci napsat pouze nick a datum. Cache ulozte na
sve misto presne tak, jak byla predtim. Diky!!!
Pascal
The Pascal language was originally designed in 1971 by Niklaus
Wirth, professor at the Polytechnic of Zurich, Switzerland. Pascal
was designed as a simplified version for educational purposes of
the language Algol, which dates from 1960. When Pascal was
designed, many programming languages existed, but few were in
widespread use. The key idea of the new language was order, managed
through a strong concept of data type, and requiring declarations
and structured program controls. The language was also designed to
be a teaching tool for students of programming classes.
Turbo Pascal
Borland's world-famous Pascal compiler, called Turbo Pascal, was
introduced in 1983. The Turbo Pascal compiler has been one of the
best-selling series of compilers of all time, and made the language
particularly popular on the PC platform, thanks to its balance of
simplicity and power.
Turbo Pascal introduced an Integrated
Development Environment (IDE) where you could edit the code, run
the compiler, see the errors, and jump back to the lines containing
those errors. It sounds trivial now, but previously you had to quit
the editor, return to DOS; run the command-line compiler, write
down the error lines, open the editor and jump there.
Moreover Borland sold Turbo Pascal for 49
dollars, where Microsoft's Pascal compiler was sold for a few
hundred. Turbo Pascal's many years of success contributed to
Microsoft's eventual cancellation of its Pascal compiler product.
After 9 versions of Turbo and Borland Pascal compilers, which
gradually extended the language, Borland released Delphi in 1995,
turning Pascal into a visual programming language. Delphi extends
the Pascal language in a number of ways, including many
object-oriented extensions which are different from other flavors
of Object Pascal, including those in the Borland Pascal with
Objects compiler.
Quiche Eaters
New programming languages brought a lot of new concepts and
technologies and attracted many new "programmers". On the other
side they brought a lot of fun for real classic programmers.
You can see this in the following charming article (written by the
way in 1983, in the same year in which Turbo Pascal was released)
called Real Programmers Don't Use Pascal, which is
very interesting even today
.
Cache
Let's go back to our task - the czech subsidiary of Borland used to
be in the downtown but today it is located in an old house close to
Vysehrad. The cache is placed nearby and its coordinates are hidden
in the program above. This program uses one of the favorite problem
- sorting. I choose the recursive Quick Sort but don't worry, the
program is quite simple. To correctly interpret the results you
might need the cipher sum of the day and month, on which the very
first version of Turbo Pascal has been released back in 1983.
Before you start to seek after the compiler, please take a look
at the last nine lines of the program and try to guess whot is
going on. It is so simple that you will probaly not need the
compiler itself!
Good luck! Please save the space in the
logbook, put only the date and nick there. Please
put the cache exactly at the same place as it was before.
Thanks!!!
Viz tez/See also:
Computer Cache #1
Computer Cache #2
Computer Cache #3
Computer Cache #4
Computer Cache #5
Computer Cache #7