18.08.2013 Views

Dalla A alla Z passando per C - Robotica

Dalla A alla Z passando per C - Robotica

Dalla A alla Z passando per C - Robotica

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.19 Resto di divisione intera<br />

Esempio:<br />

o<strong>per</strong>atore %<br />

<strong>per</strong>centuale<br />

sintassi espr1 % espr2<br />

n. o<strong>per</strong>andi 2<br />

utilizzo restituisce il resto della divisione intera tra espr1 e espr2<br />

associativita’ =⇒<br />

commutativita’ NO<br />

void stampatempo(int s)<br />

{<br />

int h, m;<br />

}<br />

m = s / 60; s = s % 60;<br />

h = m / 60; m = m % 60;<br />

printf("%i:%02i:%02i\n", h, m, s);<br />

6.20 Somma e sottrazione<br />

o<strong>per</strong>atore +<br />

più<br />

sintassi espr1 + espr2<br />

n. o<strong>per</strong>andi 2<br />

utilizzo restituisce la somma tra espr1 e espr2<br />

associativita’ =⇒<br />

commutativita’ SI’<br />

o<strong>per</strong>atore −<br />

trattino alto<br />

sintassi espr1 − espr2<br />

n. o<strong>per</strong>andi 2<br />

utilizzo restituisce la differenza tra espr1 e espr2<br />

associativita’ =⇒<br />

commutativita’ NO<br />

64

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

Saved successfully!

Ooh no, something went wrong!