break statement
De cppreference.com
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Provoque l'enfermer for, while ou <div class="t-tr-text">do-while
boucle ou 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.
instruction switch
mettre fin .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.
instruction switch</div> to terminate.
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.
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.
Utilisé quand il en est autrement difficile à terminer la boucle à l'aide de l'expression de la condition et des instructions conditionnelles .
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.
Sommaire |
[modifier]Syntaxe
break | |||||||||
[modifier]Explication
Après cette déclaration, le contrôle est transféré à l'instruction qui suit immédiatement la boucle englobante. Tous les objets de stockage automatiques déclarés à enfermer la boucle sont détruits avant l'exécution de la première ligne qui suit la boucle entourant .
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.
[modifier]Mots-clés
[modifier]Exemple
#include <iostream> int main(){int i =2;switch(i){case1:std::cout<<"1";case2:std::cout<<"2";//execution starts at this case labelcase3:std::cout<<"3";case4:case5:std::cout<<"45";break;//execution of subsequent statements is terminatedcase6: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 breakif(k ==2)break;std::cout<< j << k <<" ";}}}
Résultat :
2345 00 01 10 11