Title: OUTLINE
1????? 10???????
- OUTLINE
- ??????????????????????
- ????????????????????????
- ???????????????????????????
- ??????????????????????????????????????
- ???????????????????????????????? ???????
- ???????????????? (variant record)
2??????????????????????
- ???????
- ?????????????????????????????????????????????????
??????????????????????????? - ?????????????????????????????????????????????????
?????????????????? ???????????????????????????????
??????????????
3????????????????????????????
- ??????
- ??????????? RECORD
- ????????? ????????????
-
- ????????? ????????????
- END
- ??????? variant record ???????????????????
variant part ????????
- ????
- student record
- name string30
- stcode string7
- sex char
- end
4????????????????????????????
- Type date record
- dayname (mon,tue,wed,thur,fri,sat,
sun) - day 1..31
- month 1..12
- year integer
- end
- Var today,tomorrow,yesterday date
???????????????????????????????
5????????????????????????
- ???????????????????????? ?? 2 ????
- ???????????? ?????????????.?????????
- ????????????? WITH statement ?????????????????????
??????? BEGIN .END
6????????????????????????
- ?????????????.?????????
- today.dayname mon
- today.year 2543
- today.month 12
- today.day 15
- ?????????????????????????????????????????? ??????
with ??????????????
- WITH statement
- WITH today Do
- begin
- dayname mon
- day 15
- month 12
- year 2543
- end
7???????????????????????????
- ??????????????????????????????????????????????????
?? ???? - study record
- course string6
- grade char
- term 1..2
- year integer
- end
- Student record
- name string30
- age integer
- sex char
- take_course study
- end
-
8???????????????????????????
- ?????????????????????????????????????????
?????????????????????????????????????????????????
?????????????????????????????? 1 ???????
9???????????????????????????
- program recinrec
- uses wincrt
- type study record
- course string6
- grade char
- term 1..2
- year integer
- end
10???????????????????????????
- Student record
- name string30
- age integer
- sex char
- take_course study
- end
- var st_info student
11???????????????????????????
- procedure getinfo
- begin
- write('Enter student name ')
readln(st_info.name) - write('Enter student age ')
readln(st_info.age) - write('Enter student sex ')
readln(st_info.sex)
12???????????????????????????
- write('Enter student course ')
readln(st_info.take_course.course) - write('Enter student grade ')
readln(st_info.take_course.grade) - write('Enter student term ')
readln(st_info.take_course.term) - write('Enter student year ')
readln(st_info.take_course.year) - end
13???????????????????????????
- procedure writeinfo
- begin
- writeln ('Enter student name ', st_info.name)
- writeln ('Enter student age ', st_info.age)
- writeln ('Enter student sex ', st_info.sex)
14???????????????????????????
- writeln ('Enter student course ',
st_info.take_course.course) - writeln ('Enter student grade ',
st_info.take_course.grade) - writeln ('Enter student term
',st_info.take_course.term) - writeln ('Enter student year
',st_info.take_course.year) - end
15???????????????????????????
- begin
- getinfo
- writeln('')
- writeinfo
- end.
16???????????????????????????
- ?????????????????? getinfo ??? writeinf ??????
WITH statement ?????????
17???????????????????????????
- procedure getinfo
- begin
- with st_info do
- begin
- write('Enter student name ')
readln(name) - write('Enter student age ') readln(age)
- write('Enter student sex ') readln(sex)
- with take_course do
18???????????????????????????
- begin
- write('Enter student course ')
readln(course) - write('Enter student grade ')
readln(grade) - write('Enter student term ')
readln(term) - write('Enter student year ')
readln(year) - end
- end
- end
19???????????????????????????
- procedure writeinfo
- begin
- with st_info do ?????? with
st_info,take_course - with take_course do
- begin
- writeln ('Enter student name ', name)
- writeln ('Enter student age ', age)
- writeln ('Enter student sex ', sex)
20???????????????????????????
- writeln ('Enter student course ',
course) - writeln ('Enter student grade ', grade)
- writeln ('Enter student term ',term)
- writeln ('Enter student year ',year)
- end
- end
21??????????????????????????????????????
- ??????????????????????????????????????
- ????????????????????????????????
?????????????????????? ???? ??????????????
??????????????????????????????? ????
??????????????????????? 1 ?? ???????????????????
22??????????????????????????????????????
- ????
- type register record
- st_name string20
- st_code string7
- subject array 1..6 of string7
- end
- ??????
- type bill record
- cust_name string30
- address string30
- goods array1..10 of string 20
- price array1..10 real
- end
23???????? ??????????????????????????????????????
- ( This program declare record and in side it has
an array) - program r_w_rec2
- uses wincrt
- type person record
- name string20
- id string7
- subj array 1..6 of string4
- end
24???????? ??????????????????????????????????????
- var recinfo person i integer
- procedure readrec
- begin
- with recinfo do
- begin
- write('Enter name ') readln (name)
- write('Enter id ') readln (id)
25???????? ??????????????????????????????????????
- for i 1 to 6 do
- begin
- writeln('Enter subject name ')
- readln (subji)
- end
- end
- end
26???????? ??????????????????????????????????????
- procedure writerec
- begin
- clrscr
- with recinfo do
- begin
-
- write(name20,' ',id10,' ')
- for i 1 to 6 do
- write(subji6)
- end
- end
27???????? ??????????????????????????????????????
- begin
- readrec
- writerec
- end.
28???????????????????????????????? ???????
- ???????????????????????????????? ???????
- ?????????????????????????????????????
??????????????????????? ??????????????????????????
??????????????????????????????????????????????????
??????????????????????????????
29???????????????????????????????? ???????
- ??????
- type phon record
- phonum string 7
- custname string20
- end
- var custrec array1..max of phon
30???????????????????????????????? ???????
- ??????????????????????????????????????????????????
?????? ??????? ???????????
31???????? ???????????????????????????????? ???????
- ( This program declare array in side it has a
record.) - program r_w_rec3
- uses wincrt
- const max 1
- type person record
- name string20
- id string7
- subj string4
- end
- stlist array 1..max of person
32???????? ???????????????????????????????? ???????
- var recinfo stlist
- i integer
- procedure readrec
- begin
- for i 1 to max do
- begin
33???????? ???????????????????????????????? ???????
- with recinfoi do
- begin
- write('Enter name ') readln
(name) - write('Enter id ') readln (id)
- write('Enter subject name ')
readln(subj) - writeln('')
- end end end
34???????? ???????????????????????????????? ???????
- procedure writerec
- begin
- clrscr
- for i 1 to max do
- with recinfoi do
-
- begin
- write(name20 ',id10,' ',subj6)
- writeln
- end
- end
35???????? ???????????????????????????????? ???????
- begin
- readrec
- writerec
- end.
36????????????????????????????????????????
- type studentrec record
- id string 7
- namestring 30
- age integer
- sex char
- end
- starray array1..100 of studentrec
- program searchrec
- uses wincrt
- const max 100
- var student starray
- size integer
37????????????????????????????????????????
- procedure getrec(var iinteger)
- var tempid string7
- begin
- i 0
- clrscr
- write('Enter id (id 9999999 for
end)') - readln(tempid)
38????????????????????????????????????????
- while (tempid ltgt '9999999') and (iltmax)
do - begin
- i i 1
- with studenti do
- begin
-
- id tempid
- write('Enter name ')
- readln(name)
- write('Enter age ')
- readln(age)
- write('Enter sex') readln(sex)
- end
39????????????????????????????????????????
- writeln
- write('Enter id (id 9999999 for
end)') - readln(tempid)
- end
- end
40????????????????????????????????????????
- procedure writerec
- var i byte
- begin
- clrscr
-
- for i 1 to size do
- with studenti do
- begin
- writeln(id10,name35,age5,sex5)
- end
- end
41????????????????????????????????????????
- procedure searching
- var iinteger
- shid string7
- flagboolean
- begin
- clrscr i0 flag false
42????????????????????????????????????????
- write('Enter student id you want to search
(9999999 for end) ') - readln(shid)
- while shid ltgt '9999999' do
- begin
- i i 1
43????????????????????????????????????????
- while (iltsize) and (flag false) do
- begin
- if (shid studenti.id) then
- flag true
- else
- i i1
- end writeln
44 ????????????????????????????????????????
- with studenti do
- begin
- if flag true then
- writeln(shid10,name30,age5,sex
5,' is found') - else
- writeln(shid10,' is not
found') - end end with
45????????????????????????????????????????
- i 0
- flag false
- writeln
- write('Enter student id you want to
search (9999999 for end) ') - readln(shid)
- end
- end
46????????????????????????????????????????
- Begin MAIN
- getrec(size)
- writerec
- readln
- searching
- end.