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

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

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -