06.01.2015 Views

IMPARARE IL C++ in 6 ore? - INFN

IMPARARE IL C++ in 6 ore? - INFN

IMPARARE IL C++ in 6 ore? - INFN

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.

Switch statement:evitare if troppo concatenati<br />

Valuta una espressione e divide l’azione a seconda dei valori che tira<br />

fuori questa espressione<br />

S<strong>in</strong>tassi:: switch (espressione)<br />

{<br />

case val<strong>ore</strong>1 :statement1; //o un blocco {}<br />

case val<strong>ore</strong>2 :statement2;<br />

……….<br />

case val<strong>ore</strong>N :statementN;<br />

case default :statement; // ci switcha se nessun caso e’ vero<br />

} //altrimenti esce senza far nulla

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

Saved successfully!

Ooh no, something went wrong!