break statement
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Fa sì che il allegando for, while o <div class="t-tr-text">do-while
loop o Original:
do-while
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
istruzione switch
di interrompere.Original:
switch statement
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Original:
Causes the enclosing for, while or
do-while
loop or Original:
do-while
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Usato quando è altrimenti difficile da terminare il ciclo utilizzando l'espressione condizione e istruzioni condizionali.
Original:
Used when it is otherwise awkward to terminate the loop using the condition expression and conditional statements.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica] Sintassi
break
|
|||||||||
[modifica] Spiegazione
Dopo questa affermazione il controllo viene trasferito all'istruzione immediatamente successiva al ciclo racchiude. Tutti gli oggetti di stoccaggio automatico dichiarati in allegando ciclo vengono distrutti prima dell'esecuzione della prima riga dopo il ciclo racchiude.
Original:
After this statement the control is transferred to the statement immediately following the enclosing loop. All automatic storage objects declared in enclosing loop are destroyed before the execution of the first line following the enclosing loop.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[modifica] Parole chiave
[modifica] Esempio
#include <iostream> int main() { int i = 2; switch (i) { case 1: std::cout << "1"; case 2: std::cout << "2"; //execution starts at this case label case 3: std::cout << "3"; case 4: case 5: std::cout << "45"; break; //execution of subsequent statements is terminated case 6: std::cout << "6"; } std::cout << '\n'; for (int j = 0; j < 2; j++) { for (int k = 0; k < 5; k++) { //only this loop is affected by break if (k == 2) break; std::cout << j << k << " "; } } }
Output:
2345 00 01 10 11