How to use do while function but also not stop other codes

  c++, visual-c++

I am trying to fix this problem where if you use do and while code, it will stop other commands, but if it is done, then it will continue those commands.

for (int i = 0; i < 1000; i++) {
    std::cout << "hey";
    Sleep(1000);
}

for (int i = 0; i < 1000; i++) {
    std::cout << "hey number 2";
    Sleep(1000);
}

it is supposed to output together

hey

hey number 2

but instead it’s just

hey

and then once it’s done it’s just

hey number 2

Source: Windows Questions C++

LEAVE A COMMENT