C++: How can I make an infinite loop stop when pressing any key? -


i'm totally new programming , don't have idea other topics saying this. please explain on c++.

you can quit program, there no real way make stop key on basic level.

alternatively can use condition loop, e.g.

int counter = 0; int countermax = 100; while (true && (counter++ < countermax)) {     // code here } if (counter >= countermax) {     std::cout << "loop terminated counter" << std::endl;     // maybe exit program } 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

mysql - FireDac error 314 - but DLLs are in program directory -