1
00:00:00,000 --> 00:00:00,560

2
00:00:00,560 --> 00:00:02,460
>> DAVID J. Malan: Ejja jieħdu l-affarijiet
pass ulterjuri, issa.

3
00:00:02,460 --> 00:00:05,450
Ejja ngħidu li jien ma jridux biss
li jistampaw kollha tal-programm tiegħi

4
00:00:05,450 --> 00:00:06,630
argumenti linja tal-kmand.

5
00:00:06,630 --> 00:00:10,490
Imma I, minflok, tixtieq li jistampaw kollha tal-
karattri individwali f'kull ta '

6
00:00:10,490 --> 00:00:14,060
argumenti tiegħi linja tal-kmand, wieħed għal kull
linja, b'tali mod li malli running dan

7
00:00:14,060 --> 00:00:17,490
programm, I sempliċiment tara nixxiegħa ta '
karattri fuq l-iskrin li

8
00:00:17,490 --> 00:00:20,700
kollettivament huma minn sekwenza tiegħi
ta 'argumenti linja tal-kmand.

9
00:00:20,700 --> 00:00:21,980
>> Well, kif nista 'nagħmel dan?

10
00:00:21,980 --> 00:00:26,540
I tista 'żżomm intatta loop tiegħi minn qabel
biha I iterattiv minn i sa

11
00:00:26,540 --> 00:00:30,060
ARGC sabiex jiġu integrati aktar il-
argumenti kmand linja nfushom.

12
00:00:30,060 --> 00:00:34,460
Imma issa, fi ħdan kull iterazzjoni ta 'dak
loop, I-ħtieġa li issa jtenni fuq kull

13
00:00:34,460 --> 00:00:38,550
tal-karattri jew Chars
fil string speċifiku.

14
00:00:38,550 --> 00:00:40,620
Allura biex tagħmel dan, għandi bżonn wieħed loop aktar.

15
00:00:40,620 --> 00:00:42,090
>> Ejja jżidu li.

16
00:00:42,090 --> 00:00:46,890
għall int, ejja sejħa hija j, ikun egwali għal 0.

17
00:00:46,890 --> 00:00:49,980
Issa jien ser jeħtieġu li jintegraw
sal-tul tal-

18
00:00:49,980 --> 00:00:52,310
string attwali ARGV.

19
00:00:52,310 --> 00:00:55,910
So let me jagħtu myself ieħor lokali
varjabbli, aħna ser sejħa hija n, u tistabbilixxi

20
00:00:55,910 --> 00:01:00,120
li daqs it-tul sensiela ta 'l-
argument preżenti, li se tkun

21
00:01:00,120 --> 00:01:04,230
misjuba fil-bracket ARGV i virgola.

22
00:01:04,230 --> 00:01:08,500
>> Let me issa jtenni mill j up
sakemm n segwit minn

23
00:01:08,500 --> 00:01:10,400
inkrement fuq kull iterazzjoni.

24
00:01:10,400 --> 00:01:13,850
Ejja issa jistampaw l-individwu
karattri fuq l-iskrin.

25
00:01:13,850 --> 00:01:21,920
Printf% c dan iż-żmien segwit minn ġdida
linja, kwotazzjoni qrib, comma, u issa I

26
00:01:21,920 --> 00:01:25,565
bżonn l-karattru j th
fil-argument i-th.

27
00:01:25,565 --> 00:01:30,240
>> Allura biex tikseb fuq dan, I jistgħu sempliċiment
tispeċifika ARV bracket i li

28
00:01:30,240 --> 00:01:32,050
jiksbu l-argument i-th.

29
00:01:32,050 --> 00:01:36,140
U mbagħad I jistgħu adsa livell wieħed aktar profond
u jagħmlu indiċi sekondarju ta '

30
00:01:36,140 --> 00:01:40,420
bracket j, parentesi qrib,
virgola, Save.

31
00:01:40,420 --> 00:01:43,610
U ejja issa jikkompilaw u
run dan il-programm.

32
00:01:43,610 --> 00:01:46,630
>> Għamla ARGV2 -

33
00:01:46,630 --> 00:01:48,440
pjuttost mhux dak I kien qed jistenna.

34
00:01:48,440 --> 00:01:50,740
Ejja iscroll sa l-ewwel
ta 'dawn il-messaġġi ta' żball.

35
00:01:50,740 --> 00:01:54,540
U bl-aħmar hawn, naraw żball,
impliċitament tiddikjara funzjoni librerija

36
00:01:54,540 --> 00:01:56,290
strlen b'tip -

37
00:01:56,290 --> 00:01:57,380
oh, stenna minuta.

38
00:01:57,380 --> 00:02:00,340
Dan huwa l-ewwel darba stajt użati
strlen, u jien ma tantiċipa

39
00:02:00,340 --> 00:02:04,970
jixtiequ dan fl-ewwel, so I ma kienx jinkludi
il-fajl header li tiddikjara

40
00:02:04,970 --> 00:02:06,290
funzjoni tul string.

41
00:02:06,290 --> 00:02:09,419
>> Allura fil-quċċata tal-fajl tiegħi,
recall, I jkollhom CS50.h.

42
00:02:09,419 --> 00:02:11,080
Għandi io.h. standard

43
00:02:11,080 --> 00:02:14,500
Iżda jirriżulta, u naf dan mill
qari dokumentazzjoni, li għandi bżonn

44
00:02:14,500 --> 00:02:18,320
fajl header terz jekk I, tabilħaqq,
trid tuża l-funzjoni strlen.

45
00:02:18,320 --> 00:02:22,760
Din il-funzjoni hija ddikjarata fil string.h.

46
00:02:22,760 --> 00:02:25,230
>> Ejja resave-fajl,
jikkompilaw, u run.

47
00:02:25,230 --> 00:02:32,360

48
00:02:32,360 --> 00:02:35,570
U din id-darba, aħna ma biss
tara kull wieħed mill-argumenti.

49
00:02:35,570 --> 00:02:40,470
Aħna minflok jaraw lil wieħed mill-argumenti
karattru wieħed fi żmien.

50
00:02:40,470 --> 00:02:43,165