g. surgulaZe, g. janeliZe, i. xuciSvili

g. surgulaZe, g. janeliZe, i. xuciSvili g. surgulaZe, g. janeliZe, i. xuciSvili

01.03.2013 Views

} long nc; /* nc – simboloebis mTvlelia */ nc = 0; while (getchar() != EOF) ++nc; printf("nc =%1d ", nc); /*%ld–long tipis cvladis formatis specifikatoria */ return 0; Sedegi: abcde klm?n x*yzu^Z nc =17 kidev erTi programa dagvidgens, ramden striqonad aris dayofili klaviaturidan Setanili mimdevroba. #include main() { } p char ?; int nl; /* aq nl – striqonebis mTvlelia */ nl = 0; while ((?= getchar()) != EOF) if (?== '\n') ++nl; /* '\n' – axal striqonze gadasvlis simboloa */ printf("nl=%d ", nl); return 0; rogramis Sesrulebis Sedegi: pirveli striqoni meore striqoni mesame meoTxe ^Z nl=4 69

moviyvanoT programa, romelic klaviaturidan Semosul mimdevrobaSi daiTvlis simboloebis, sityvebis da striqonebis raodenobas. sityva – simboloebis nebismieri mimdevrobaa, romelic ar Seicavs xarvezebs, axal striqonze gadasvlisa da tabulaciis simboloebs. #include main( ) { } { char c; int nc, nl, nw; nl = nw = nc = 0; while ((c = getchar()) != EOF) } ++nc; if (c== '\n') ++nl; if (c == ' ' || c == '\n' || c == '\t') nw++; printf("nl=%d nw=%d nc=%d ", nl, nw, nc); return 0; Sedegi: abc def bn cde bnm ghj ^Z nl=2 nw=6 nc=23 programis cvladebi nc – simboloebis, nw – sityvebis, nl – striqonebis mTvlelebia. simboluri konstantebi ' ', '\n' da '\t' aRniSnaven xarvezis, axal striqonze gadasvlisa da tabulaciis simboloebs Sesabamisad. nc mTvlelis mniSvneloba warmoadgens inglisuri asoebis (17), xarvezebis (3), tabulaciisa (1) da axal striqonze gadasvlis (2) simboloTa saerTo raodenobas. 70

}<br />

long nc; /* nc – simboloebis mTvlelia */<br />

nc = 0;<br />

while (getchar() != EOF)<br />

++nc;<br />

printf("nc =%1d ", nc); /*%ld–long tipis cvladis formatis specifikatoria */<br />

return 0;<br />

Sedegi: abcde klm?n x*yzu^Z<br />

nc =17<br />

kidev erTi programa dagvidgens, ramden striqonad aris<br />

dayofili klaviaturidan Setanili mimdevroba.<br />

#include<br />

main()<br />

{<br />

}<br />

p<br />

char ?; int nl; /* aq nl – striqonebis mTvlelia */<br />

nl = 0;<br />

while ((?= getchar()) != EOF)<br />

if (?== '\n') ++nl; /* '\n' – axal striqonze gadasvlis simboloa */<br />

printf("nl=%d ", nl);<br />

return 0;<br />

rogramis Sesrulebis Sedegi:<br />

pirveli striqoni<br />

meore striqoni<br />

mesame<br />

meoTxe<br />

^Z<br />

nl=4<br />

69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!