15
U*tlW
Uing the #define strtcmcnt Liæ I and Lim 2 of rh€ prcgnm contain thc #defiûe $âtcmcnL Thc *d€tinc starcmcnt .'#defitc for a patialtr dcfiues a æ srring of chmçteG IB thÊ ebfle progm STR '0"' tells the omputer that ilytime ir coms acros the nmc "STR", ir should replacc it with the chæder "0". Likryisq " #define END 'Z' " rells the @mputd that thc @ is to bc EpLaæd with thc chaBcter "2", "END" for using thc # dcfinc ststqmt ir to Gte prcgems 6icr to sd ud to chsngs letq. If, in thc abm prcgnn rc ùscd thc chaBctcr "0" a lMbq of timË thrcu8ùoul th€ prcgm md w wished to changc all of thm to "A', it would b€ much 6i€r to chegc the #definc statmeot onca, Bthf thæ makirg multiple charyÉ The twon
lnrtmendng and decrcmenting hcE cstablirh6 thc initial nluc for wiablc "ch" æ ,.'0"', and a€lls it to keep repeating the Iæp "whilc (ch
srrnd(reedl ra.d;
i
l*
O.0 < s..d < ' l.O
t * 30000.0; -!c.d l .tccd l t {-8 r.d l 0, 0 rctun€d; if x=0, I Etumcd) Forced ænvc$ioo/rpccifioliotr of r (@r opcrator). Vsiablc x btÊc lfigih wluc siæf(typc) illcSd.
-x !x (lyF) x siæf (x)
Corôd,ord
ahcir fuÉ-tio$'
PèMatEtical fmdion argum6! opcntio$, SpçcifJ arny dmcnts, Spæify rtructun mcmbæ SHifr6 structurc membds using pointcr'
Unrt opotoE *F rh +)! -r + + x , --x x + + ! x- -
r&y r^y xly te&! ril y
uscd by C dd
Multiplidtioû, divirio& modulB (mainder of x dividcd by y). Addition. suhnctim. x hft bir shift./ri8ht bit shift y tim* nchtionÂl opcntoE (tne-I, falæ=o). Equalily (uræqual-O' cqual=l)' lD€qustity (uncqusl= l, cqùal=0). Bit AND of x md y. Bir XOR of x srld y, Bit OR of r end y. t giel AND of x and y (l if ncithn x strd v æ 0). Irgiel oR of x and y û if trcittt x or v æ O).
(|iiloDlrl
opcnl6)
y if r È truc (othcr thaD o), z lf r is fals (O).
x 1 y Iz
Ardtmt opntoE AsigE y to wiable x' x=y Multipli6 x ùy y and ssign$ Eult to r xt =yex-x*y Dividcs x by y N4d ssigtr 6ul1 to x. x/=yoa:a1y rr7.-yr x+ =lrl,x- =y, x< < =y, x> > =y, nÈ-y' x | =y, x^:y Thc follwing
hble shm
the prctdere
and âsiativity
of thc abæ
opcBtoÊ
t!l
CtAtrC
Ch*ùfr
P@aæ
of Ofat
r
^rodrddqr
-a P|lcrdæ
A&irrnitt
ODaûoÉ
( ) , n, * >
Hirrt UEy
L4ft ao.tùr
r +, - -,
Mùltipli.rih/ divida
-, (IlD.),
*, tt, riæf
+ .t.i
I4fr ro rltùr -
Al.iti.E/ sùadiù
+
snift
lrft b rbùt + Irtr o rllln
nd.ddf E$dity IIit AND
&
trâ ro rlfhr + kfr b rthr
Bir r(On lIr On r.d..l
AND
l!|lc.l
Of
-
Cotditioûd
I
Arirwa
-,
Lft
b rtllt
Irft
to ri!ùt
-
&t
Lô to rirbl
+-,
--,
r
*=,/-,oràa
Ord
-À" &&< I .Thc PBAXXTCrtæ
*rinj
iù!Èd.
='Z'l 2 | z 0;
tbc folbdrt
d.tr Ntm.tÈ.[y:
*dcfiDc NI,LL 0 #&fio. EoF -l *dcdhc FILE cùrr ch.r *ddir; cùrr *idolt; cùt *rôcr; intGm; H@,
qra!
dcdutbr
ir rqqiËd ùo e
{dir,
ddoltt, nddr ed moÀ
llt
4Fdtrr, dr2); cùû *rtrl, *strz;
App@rb strins !&2 ro 6d of driût rtrl.
tlrEpy(trar, fstr); chù l.trtr, *frÊr;
Copicr rtriry frtr to ltrht
r-|lr@D(rtrl, |tttrl, 6ù iot r;
Crmp|Ë rrtwO
nr2); *|r12;
| =lrrlc{dr); cùar tt rtr i int l;
IÊtuû
arry tstr.
ûiûa rtrl ytah drirg !trz. lf idc!tuL lf dillcmt Eturu db6thrO.
lcngth {numbq of chucrcB) of ilrina $r,
Nrncric Surcdorr
ilt
y = qrt{x)
Calilla6
rqurc mt
y
- rin(x) y = cs(r)
C.kùlû6
3le
Crhrlrta
ûiæ
Y - trn(r)
ùlohtca
t[lant
y rbr(r) y * rp(r)
C.lculûË
rtcûtrtaa
Cdfll-.
ÊFffir
ôf r
y * lo!û)
CrlculrlË
[aunl
bt|ri]hm
r - p o fty)
Cdculd6
r to tbc pG
qlCn)
Spæifr6 tlæ unit of auuhr ÉumcnL n-0: DEO, I : l D, 2: GRAD
m z ebs{n)
Ædjm thc nal vduc of intqc typc dE D.
of r.
of r.
of r. of r, of r.
of L
of y.
rypc velw n to intcgr
priûtf(rr ûtùûlzr-X fpdntf(fp, !' ql,8r4-.)
PEfoæ
;
r, sSI,q2,-)3 rp.iDt(* cbrr rl.r; eqptr$im FII.E i.S] ecùrtrla|rÎry cbû dl; to b. uillo æ.n(|' ûtl,..fÀ-); ftÊ.a(fo, r r[l,|tf2
-);
!sânf(r., r rrtl,!rfÀ-)i tfr; èaprBdoo dur rrh; FtlE ttfi& ràr, tts: êcbtæLr to bc ta.l
Op.lht
ertl doôS
flË
fp-tuna(flamc chu dtfltame Fll.E t*fp; m=fdor(fp); PILE ITfp; iil ffi;
of qpcdoî
hrfm
oùrlDt qtput
b. ftrfmr
qtFrt of apctùn
of aprltrim
nrbrn[ input of rrpn:do ilp|rt of spr!.riol hrbrE tr fF irnn of aDæ$irn kdm s . whm fuElim Etu ==
oulFri. to lrÉûd to bt to fib toinlld
lo ùmc{cr rny e
inFt. fm ûrùd tiom lihtoitrtotl to fm
cbatrls
EOF, æ
nrir3
d @F.
(S) modc); {