Not that you should use a "goto" in your program your first problem is that "top:" needs to be inside the opening brace of main.
is there any function that allows writing to specific line? not really sure what you mean by "writing to specific line".
The corrected code will be an endless loop printing one "word1" after another with no way to stop. A slightly better solution would be:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
#include <cstdlib>
int main()
{
int i{ 0 };
do
{
std::cout << "word1 "; //change this word to something else
i++;
} while (i < 5);
system("pause"); // not the best choice, but will do for now
return 0;
}
It does the same as your code, but shorter output instead of an endless loop.
I do not mean this in a bad way, but if you do not like the answer ask a better question.
Hope that helps,
Andy
P.S. You can use the gear icon in the top right corner of the code block to test.