Giao an tin hoc 11 - Tuan 11 - Bai 16 Vi du lam viec voi tep - v02 - vtq ngoc

  • Published on
    20-Jul-2015

  • View
    813

  • Download
    1

Embed Size (px)

Transcript

HSP TPHCM

TRNG: PTTH LNG VN CANNM HC: 2013 - 2014

LP:Tun:

GVHD: Bi Mng Thy UynNgy:

GSTT : V Th Qunh Ngc

Tn bi hc: V D LM VIC VI TP

I- Mc tiu:1- Kin thc: Cng c li kin thc hc v tp trong bi 14, 15 ca chng V thng qua v d. Hiu cc thao tc c bn vi tp gm gn tn tp, m tp, ng tp, c/ghi d liu t tp.

2- K nng: Nhn bit c cc cch hot ng ca tp. Bit s dng cc th tc v hm lin quan gii quyt bi ton khi lm vic vi tp. Nm c chc nng ca cc th tc v hm thao tc vi tp

3- Thi : HS thy c s cn thit v tin li ca kiu d liu tp

II- Chun b ca gio vin v hc sinh:GV: Phng hc trn lp vi phn bng, khn lau. Gio n. HS: SGK

III- Phng php dy hc: Thuyt trnh, vn p.

IV- Tin trnh bi dy:

Hot ng 1 (13'): n nh lp, kim tra bi c.TGHot ng ca gvH/ ca hsNi dung

- Gi 2 hc sinh ln bng lm bi tp. Sau gio vin cha bi.

- Gio vin v s vi ni dung rng ln bng

- Lu cn khai bo bin tp:var tep1, tep2: text;- HS ln bng lm bi tp, cc hc sinh khc ch theo di.Bi 01. *) Vai tr ca kiu tp l g?- Lu tr d liu lu di b nh ngoi.- Lu tr lng d liu ln.

*) Nu 2 cch phn loi tp? - Xt theo cch t chc d liu:+ Tp vn bn.+ Tp c cu trc.- Xt theo cch thc truy cp:+ Tp truy cp tun t.+ Tp truy cp trc tip.

Bi 02. Hy in thng tin vo s lm vic vi tp.

Hot ng 2:(30'). 16. V d lm vic vi tp

TGHot ng ca gvH/ ca hsNi dung

15'

15'

- Ghi ni dung bi ln bng. M t tp ta , gi tnh khong cch.5*5= 3*3+4*4

- Yu cu 1 HS ln vit phn khai bo chng trnh.

- Yu cu 1 HS ln vit chng trnh.

- GV chnh sa li nu c li.

- Ghi ni dung bi ln bng. Gi cho hs

- Yu cu 1 HS ln vit phn khai bo chng trnh.

- Yu cu 1 HS ln vit on chng trnh gn tn tp cho bin v m tp.

- Vit on chng trnh chnh v ging gii cho hc sinh hiu.

- Ghi bi, c k .

- 1 HS ln vit khai bo chng trnh.

- 1 HS ln vit on chng trnh.

- Ghi bi, c k .

- 1 HS ln vit khai bo.

- 1 HS ln vit on chng trnh.

- Lng nghe, ghi bi16. V d lm vic vi tp

Bi 01: Vit chng trnh c cc cp ta t tp ToaDo.TXT, tnh ri a ra mn hnh khong cch t tm O ti mi nh.

program bt1;var f: text; x, y: integer; d: real;begin assign (f, ' ToaDo.TXT'); reset (f);

while not eof (f) do begin read (f, x, y); d := sqrt (x*x + y*y); writeln ('Khoang cach: ', d:10:2); end;

close (f);end.

Bi 02: Cho tp vn bn TepA.txt, mi dng ca tp cha mt s nguyn.Vit chng trnh lc cc dng cha s nguyn dng t tp TepA.txt sang tp mi TepB.txt.

program bt02;var f1, f2: text; n: longint;begin assign (f1, 'TepA.txt'); reset (f1); assign (f2, 'TepB.txt'); rewrite (f2);

while not eof (f1) do begin readln (f1, n); if n > 0 then writeln (f2, n); end;

close (f1); close (f2);end.

V- Cng c v dn d (2):

- Nhc li vai tr ca kiu tp l dng lu tr d liu lu di, v lu tr lng d liu ln. - Hm nay chng ta thc hnh cc thao tc c bn khi lm vic vi tp: Khai bo bin tp, Gn tn tp cho bin tp, M tp c hoc ghi, c d liu t tp. Ghi d liu ra tp, ng tp.- Dn d: V nh n tp li cc bi hc

Ngy..... thng.... nm 2014

Ngi sonDuyt ca gio vin hng dn

V Th Qunh NgcBi Mng Thy Uyn

2