1
00:00:00,000 --> 00:00:00,720

2
00:00:00,720 --> 00:00:03,190
>> DAVID J. Malan: Ejja ngħidu li nixtieq
li timplimenta programm li tqanqal

3
00:00:03,190 --> 00:00:06,650
l-utent għal string u mbagħad tipproċedi
għall-kapitalizzazzjoni input tagħhom,

4
00:00:06,650 --> 00:00:09,790
konverżjoni xi ittri zghar
li dawn it-tip li uppercase.

5
00:00:09,790 --> 00:00:11,770
Well, ejja imorru quddiem u
jimplimenta l-programm.

6
00:00:11,770 --> 00:00:18,760
>> Ejja ewwel jinkludu cs50.h segwit
billi jinkludu stdio.h.

7
00:00:18,760 --> 00:00:23,990
U hekk li nistgħu nużaw strlen,
ejja jinkludu string.h.

8
00:00:23,990 --> 00:00:29,860
>> Ejja jmiss tiddikjara null prinċipali ewlieni kif int
u ejja issa tipproċedi għall-pront

9
00:00:29,860 --> 00:00:31,600
l-utent għal string.

10
00:00:31,600 --> 00:00:34,840
Printf, ejja twassalhom
għal xi input.

11
00:00:34,840 --> 00:00:36,460
Issa ejja tiddikjara string -

12
00:00:36,460 --> 00:00:37,630
aħna ser sejħa hija s -

13
00:00:37,630 --> 00:00:44,010
u jaħżnu fiha r-riżultat ta 'sejħa
l GetString funzjoni librerija cs50.

14
00:00:44,010 --> 00:00:48,850
>> Ejja issa tipproċedi biex jtenni fuq kull
mill-karattri fit s-kapitalizzazzjoni

15
00:00:48,850 --> 00:00:50,650
xi ittri zghar li naraw.

16
00:00:50,650 --> 00:00:53,630
Għal int, i nikseb 0.

17
00:00:53,630 --> 00:00:58,780
Ejja wkoll jiddikjara n bħala ugwali għal
it-tul sensiela ta 'i sabiex inkunu nistgħu

18
00:00:58,780 --> 00:01:03,590
jtenni minn i sa n, il-
tul ta 'i, u fuq kull

19
00:01:03,590 --> 00:01:05,760
i inkrement iterazzjoni.

20
00:01:05,760 --> 00:01:09,970
>> U mbagħad ġewwa ta 'dan loop, ejja
ewwel verifika huwa l-ittra attwali -

21
00:01:09,970 --> 00:01:12,270
l-ittra i-th i, biex ngħidu hekk -

22
00:01:12,270 --> 00:01:14,170
ittra zghar.

23
00:01:14,170 --> 00:01:23,090
Jekk i bracket i huwa akbar minn jew daqs
biex zghar a, u huwa inqas

24
00:01:23,090 --> 00:01:26,900
minn jew daqs z zghar -

25
00:01:26,900 --> 00:01:30,860
Issa jekk irridu li jikkonverti lowercase
ittra lill uppercase, tfakkar l-ewwel li

26
00:01:30,860 --> 00:01:35,810
fil ASCII a lowercase a huwa 97
u uppercase A huwa 65.

27
00:01:35,810 --> 00:01:41,020
Sadanittant, lowercase b huwa 98,
u uppercase B huwa 66.

28
00:01:41,020 --> 00:01:44,180
>> Jekk aħna nkomplu nħarsu lejn dak il-mudell,
aħna ser tara li l-zghar

29
00:01:44,180 --> 00:01:49,240
ittri huma dejjem 32 f'valuri ogħla
mill-ittri majjuskoli ta 'kulur.

30
00:01:49,240 --> 00:01:53,490
Mela jekk irridu li jikkonvertu mill-zghar
li uppercase, għandu

31
00:01:53,490 --> 00:01:57,210
biżżejjed, verament, li naqqas
32 minn input-utent.

32
00:01:57,210 --> 00:02:01,330
Jew b'mod iktar ġenerali, biss naqqas li
differenza bejn zghar u jservi ta '

33
00:02:01,330 --> 00:02:02,310
kapital A.

34
00:02:02,310 --> 00:02:03,410
>> Kif jesprimu dak?

35
00:02:03,410 --> 00:02:04,640
Well, ejja tagħmel dan fil-kodiċi.

36
00:02:04,640 --> 00:02:09,960
Printf, kwotazzjoni, unquote "% c" biex print
l-karattru attwali, segwit minn

37
00:02:09,960 --> 00:02:18,500
istampar x'ikun s fis bracket s minus i
ir-riżultat ta 'kif isir zghar a

38
00:02:18,500 --> 00:02:22,660
minus uppercase A virgola.

39
00:02:22,660 --> 00:02:27,010
Fi kliem ieħor, dan parenthetical
espressjoni, ftit big A minus, huwa

40
00:02:27,010 --> 00:02:29,360
ser jirritornaw għall us fi
l-aħħar tal-ġurnata 32.

41
00:02:29,360 --> 00:02:31,230
Imma jien ma jkollhom tiftakar
li huwa 32.

42
00:02:31,230 --> 00:02:34,150
I jistgħu jippermettu l-kompjuter biex insemmu
x'inhi d-differenza bejn zghar

43
00:02:34,150 --> 00:02:35,990
a u l-kapital A huwa.

44
00:02:35,990 --> 00:02:39,610
>> Sadanittant, ladarba naf li differenza,
I jista naqqas minn s

45
00:02:39,610 --> 00:02:43,710
bracket i, li se jieħu x'hemm
preżumibbilment ittra zghar għal

46
00:02:43,710 --> 00:02:48,100
valur aktar baxx, jiġifieri valur li l-mapep
fuq ekwivalenti uppercase.

47
00:02:48,100 --> 00:02:51,240
Ejja issa jiffranka, tiġbor,
u run dan il-programm.

48
00:02:51,240 --> 00:02:57,760
Kun kapitalizzazzjoni dot slash kapitalizzat.

49
00:02:57,760 --> 00:03:01,290
U l-input tiegħi se tkun bonjour.

50
00:03:01,290 --> 00:03:02,920
U hemm aħna għandna, bonjour.

51
00:03:02,920 --> 00:03:05,570
>> Issa fil-pront tiegħi, ċertament, hija
daqsxejn ikrah, għaliex konna

52
00:03:05,570 --> 00:03:07,810
barra waħda daqsxejn ta 'stampar.

53
00:03:07,810 --> 00:03:09,370
U ejja mur lura u jżidu li.

54
00:03:09,370 --> 00:03:12,890
Fil-qiegħ nett ta 'dan il-programm,
Jien sempliċiment ħafna, u ġeneralment għall-

55
00:03:12,890 --> 00:03:18,440
funzjoni estetika, se jżid printf,
kwotazzjoni, unquote backslash n.

56
00:03:18,440 --> 00:03:22,330
Ejja resave dan il-fajl,
recompile, terġa 'ssir.

57
00:03:22,330 --> 00:03:28,090
>> Jagħmlu kapitalizzazzjoni, dot slash kapitalizzazzjoni.

58
00:03:28,090 --> 00:03:32,540
Għal darb'oħra, għall-input I ser jipprovdu "bonjour"
f'kull każ inqas u issa hit Ikteb,

59
00:03:32,540 --> 00:03:34,550
u "hello," ħafna aktar nadif stampati.

60
00:03:34,550 --> 00:03:36,432