WWW.DISSERS.RU


...
    !

Pages:     | 1 |   ...   | 10 | 11 || 13 | 14 |   ...   | 21 |

} B caapo oee (Turbo) C stdio.h ec e y, ec pacpe y printf scanf oepae o/o e a, a cpo.

y sprintf o cpoy, apec oopo aaec ep apaepo: int sprintf (char *dest, char *format, );

y sscanf ae cpo, apec oopo aaec ep apaepo int sscanf (char *dest, char *format, ).

C po a c a e p oca popae cpoox epeex yaa acao oooe oeco coo cpoe, apep:

Var A:String[10];

Ec o apaep oye, apep:

Var A: String;

o o oaae, o acaoe co coo cpoe pao 255.

Ta opao cpooy epeey oo paccapa a acc coo, .e. ec epeey A oec cpoy 'aca' (A:='aca'), o A[1]='', A[2]='a', A[3]=='c' .. yc acaoe co coo cpoe Apao 10, oa y epeey oo opa e cxe:

A 7 A c A 0 1 2 3 4 5 6 7 8 9 Ha cao ee, a o o cxe, epeea A aae a a o a oe acaoo ca coo cpoe, ooy o yeo eee aoo acca xpac opa o eye oece coo cpoe. Bae pepe coo aca coep 7 y (coo), ceoaeo, A[0]='7' (A[0] e co, a co '7').

C poo e y poe yp a cae Oeee cpo. yc A, B, C epeee a String, A = 'Turbo', aB ='Pascal', oa peyae oe oepaopa C:=A+"+B;

oy epeeo C cpoy Turbo Pascal.

opoae ("pea").

Copy (St, Index, Count );

y opye cpo St Count coo, aa c coa c oepo Count. Hapep, peyae oe C:= Copy (A, 2, 3);

oy epeeo C cpoy 'urb'.

aee coo cpo.

Delete (St, Index, Count);

poeypa yae Count coo cpo St, aa c coa c oepo Index. Hapep, peyae oe Delete (B, 4, 3);

oy epeeo B cpoy 'Pas'.

Bcaa coo cpoy Insert(subst, st, index);

poeypa cae ocpoy subst cpoy st, aa c coa c oepo index. Hapep, peyae oe Insert (A, B, 4);

oy epeeo B cpoy 'PasTurbocal'.

Opeeee cpo Length(st);

y eoo a (Integer) opaae y cpo st. Hapep, yc k epeea a Integer, oa peyae oe k:= Length(A) oy o epeeo co 5 (k = 5).

oc ocpo cpoe.

Pos (Subst, St);

y eoo a (Integer) ocae cpoe St epoe xoee ocpo Subst opaae oep o, c oopo oa aaec; ec ocpoa e aea, o opaaec o. Hapep, k:=Pos('rb',A); ac k=3, a k:=Pos (A,B); ac k=0.

peopaoae ca cpoy Str(X,St); Str (X : Width: Decimals,St);

poeypa peopaye co X (Integer Real) cpoy St. oa yaa Width oee co coo X Decimals co ao oce eco ao. Hapep, yc X epeea a Real X = 1.2345, oa peyae oe Str(X, C); oy C = ' 1.2345000000E+00', a peyae Str(X : 6 : 4, C); oy C = '1.2345'.

peopaoae cpo co Val(St, X, CODE);

poeypa peopaye cpoy St ey eecey epeey X. apaep CODE (epeea a Integer), coep o, ec peopaoae poo yceo, oep oooo coa cpoe, poo cyae. Hapep, epeea C (a String) coep cpoy '123.456', oa Val (C, X, k); ac X = 123.456, k = 0. Ec C = '123,456', o k = 4, a epeea X ye e opeeea.

pa a ocpoe paecx opae a pae ce oey y C e aop paecx y, oope oy a popa a e C. cooa y paeco oe oopyoae BMoo oepa pacpoy pay.

Pacpoa paa apyec a o ce aee apecyeo oe a pae oopa.

C py ypa pa e c o po pa a paeca C-popaa opayec o ceye cxee:

- ycaoa eopea;

- coae aypoae paec oea;

- occaoee epoaao eooypa epe xoo popa.

B C-popay, coyy paece y, oe e (peo #include) a . a graphics.h oe cpyyp coecx oca, coyee paec y, a a e poo paecx y. B coca paeco oe xo ooo 80 y.

o aae x oo ycoo pa a ceye ce py:

- aa paeco cce paecoo pea;

- paoa c pacpo cee a c yepo cpyypo oe;

- ypaee eo;

- aoe y ocya eoa;

- paece p;

- o paecx ecox cooe;

- opaoa oox cya.

c aoa e ope a ep ao o paeco popa ec ycaoa eopea, oeceaeo peyee paece oepa. Beope opeee paep paa cex oeco oycx eo.

paece paep, xoe Turbo C, coepac ec oex aax, ex pacpee.bgi. a a coep ap opa paepa ooo ecox x o y aaepo.

22 a paecx paepo BGI Hoep Paep ce aaep, ocyae aa aa (a) cooecy paepa 1 CGA.BGI 6253 CGA, MCGA 2 EGAVGA.BGI 5363 EGA, VGA 3 IBM8514.BGI 6665 IBM4 HERC.BGI 6125 HERCULES 5 ATT.BGI 6269 ATT6 PC3270.BGI 6029 3270PC poe oca, yaax a. 22, graphics_drivers ae ee e: DETECT=0 CURRENT_DRIVER=-1.

poce popaca cocoo e paepa popay ec eo aoaeca apya c oo y initgrahp. a y, oo pox oex e ec, e a ce BGI-a, coepa peye paep, apyae a eo aec eey oac a acpaae po paeco cce a paoy c paepo.

Heocao oo cocoa ec opaee cy e BGI-aa o pe oe aa. Ec aoe ycoe e cyae popaca, oo e ooac. cooa pa eoxoo paecy oey GRAPHICS.LIB o cacc ocoo y aa oe ao:

Void far initgraph (int far *graphdriver, int far *graphmode, Char far *pathtodriver);

Apyea o y c yaae a epeee, coepae oep paecoo paepa, oep paecoo pea oo paepa y peop coepae BGI-a paepa.

Ec epeeo *graphdriver epe oo y o pcoeo aee DETECT ( 0), o caaa aycaec poeypa aoaecoo ecpoa aapayp c e opeee a ceoo aaepa. a oo poeypa ecpoa epe eopaeoe aee (.e. oapy co eoaaep), aeee ecpoae pepaaec, y initgraph epexo apye cooecyeo BGI-aa.

a poeypa ecpoa eoaaepa, ycaoea popaco p oapye aaepa, opaae peoeyeoe paepa oo aaepa aee paecoo pea. ooy, ec aee *graphdriver o DETECT, o apye graphmode y graphdriver oppyec. Ec oa poeyp ecpoa aapayp e oapya cocae co ce aaep, y initgraph pepaae paoy c oo 2.

puep:

#include #include void prim(void) { intgdriver=DETECT, gmode, errorcode;

initgraph (&gdriver, &gmode, \\TC\\BGI\\);

errorcode=graphresult();

if (errorcode != grok) printf ("Graphics error: %s \n", grapherrormsg (errorcode));

printf ("Press any key to halt:");

getch();

exit (1); /*return with error code*/ closegraph();

} main () { extern void prim (void);

void prim ();

} Pa o a c pa c po oe Pacp cee o yepa cooyoc oe, pecaa pa ce. Byepe ceoo aaepa oy oeac o ecoo ax pacpo oaox poyox acco cee. a ao acc ec opa paa aaec cpae. oeco cpa eoa ac o a aaepa ycaoeoo a oe paecoo pea. Paep cpa ac o paecoo pea (a. 23).

o pao popae e oooc oopa a pae y exc cpa eoa, paeco oee peycopea y void far setvisualpage (int page);

y eeeo oopa a pae y cpay eoa, oep oopo epea ee aece apyea. Cpa yepyc, aa c 0.

Ha ao cpae eoa cyecye ccea oopa (X, Y). Haao cce oopa e eo epxe yy cpa (paa). Oc X poxo o epxey pa cpa cea apao, oc Y o eoy pa cepxy .

23 paece pe Paep cpa, ce 0 CGACO C0 1 04H 320 1 EGAHI 16 2 10H 640 0 EGALO 16 4 0EH 640 0 VGALO 16 4 0EH 640 2 VGAHI 16 1 12H 640 Opee acaoe aee oopa oe, oycoe ao paeco pee, oo c oo yx y: intfargetmaxx(void); intfargetmaxy(void); ae, opaaee y, ac oo o eyeo paecoo pea.

B pacope popaca, poe cpa a eoo, eec paecoe oo co ce cceo oopa.

Oo ee epeee paep oe paeac o ece cpa.

popaca ec oooc ypa paepa pacooee paecoo oa aec. eaec o c oo y.

void setviewport(int left, int top, int right, int bottom, int clip);

BIOS Hoep eo Pe pea pea cpa oeco oeco epe epe apyea o y ec oopa eo, epxe, pao e pa paecoo oa ccee oopa cpa. H oa x pa e oe ea a peea pa.

p ycaoe ooo paecoo oa eya paeca o aoaec oeaec eo aao oopa. B aee ee oopa oy ec c oo y void far marto (int x, int y); void far marler (int dx, int dy); epa oeae eyy paecy o o yaa oopaa paecoo oa. Bopa epeeae eyy paecy o a eop (dx, dy).

oopa eye paeco o ccee oopa paecoo oa opaac ye Int far getx(void); int far gety(void);

p epeycaoe paecoo oa ye setviewport coepoe cpa eoa e eec. oc paecoo oa coyec y void far clearviewport(void);

Teya paeca o epeeaec aao oopa paecoo oa.

y void far cleardevice (void) oae c ay cpay.

paee e o caoa eyeo ea oo paecoo eopea setcolor(color);

long gettextcolor(void); ey e eca;

settext color; ycaaae e eca;

getbkcolor(void); e oa;

setbkcolor(bkcolor); ycaaae e oa;

long bkcolor; e oa;

short color; e eca;

y settextcolor setbkcolor opaa aee peyeo ea eca oa.

Bce ae ea o 16 o 31 oo e ea, o o 0 o 15, o oo c epae.

pa ec e p pye oypx paecx po oocc ceye y.

void line (int x1, int y1, int x2, int y2);

void linerel (int dx, int dy);

void lineto (int x, int y);

void rectangle (int left, int top, int right, int bottom);

void drawpoly (int numpoints, int *polypoints);

void circle (int x, int y, int radius);

void arc (int x, int y, int stangle, int endangle, int radius);

void ellipse (int x, int y, int stangle, int endangle, int xradius, int yradius);

y line, linerel lineto coe e o ococ opeo po. epo x oe coeee o yaac o co oopaa. y linerel lineto aece epo o coy eyy paecy o, a opy pa aaoo y moverel moveto, .e. epe ppaee oopa o oy yaa; p o eya paeca o epeeaec o opy oy. Bce p y oyc cceo oopa eyeo paecoo oa.

y rectangle pcye a cpae eoa oyp poyoa cooec c yaa e epx pa ya.

y drawpoly pcye oay , coe opea px oceoaeoc oe a ococ. B epo apyee e epeaec oeco x oe, a opo yaae a acc ex ce. aa apa ce oo acca eppepyec a apa oopa (x, y) oepeo o.

y arc ellipse epae y opyoc ca, cooeceo opaex ya stangle endangle. y aaec ee ep. ya ca opeeec ya, epo payco yx oce.

Pages:     | 1 |   ...   | 10 | 11 || 13 | 14 |   ...   | 21 |



2011 www.dissers.ru -

, .
, , , , 1-2 .