When is a do-while the better choice over other types of loops? What are some common scenarios where its better than others?
I understand the function of a do-while,
I usually use a do-while when something needs to happen, but it won't necessarily happen "correctly" on the first time. For instance:
int x; do { x = random.next(100); cout << x << endl; } while (x != 13);
In this case, the x you start with doesn't matter at all, because it's overwritten.