while schleife unterbrechen
-
Für Linux hat seldon schon geantwortet.
Ansonsten: (so wie ich es machen würde,..
)
#include <conio.h> #include <stdio.h> . . . while(!bDone) { if(kbhit()) //is an keyboard key hit ? { ch=getche(); //then grab it and echo the key to screen switch(ch) { case 'y' : { //do something else bDone=true; //end loop condition break; //just exit the switch block }; case 'n' :{} //'n' and default do the same here, they resume to the loop default: { break;} //just exit the switch block } }; //end of while loop
grüße