Chat with our AI personalities
The nested loop.
The two types of looping include the closed loop and the open loop.There is the count loop, the conditional loop and the unconditional loop.
QBasic is a type of question basic π€π€π€π€π ππ€£ππ
#include<iostream> #include<vector> #include<string> int main() { std::vector<std::string> names; for (int loop=0; loop!=10;) { std::cout << ++loop << " enter a name: "; std::string name; std::cin >> name; names.push_back (name); } }
It comes from its name: it doesn't terminate, the user have to interrupt the program-run (in the worst case: power off the computer).The infinite loop is also used to program loops with non-easily-deterministically end-of-loop conditions.You write an infinite loop, such as for (;;) {statements}, and break out of the loop with the break statement when ready to terminate.