New course! Every coder should learn Generative AI!
Try a free lesson+ 5
You can use do..while loop for that purpose.
do
{
// Do whatever you want here
char again;
std::cout << "Do you want to repeat (y - n)";
std::cin >> again;
} while (again == 'y' || again == 'Y');
But this type of loop can be tricky to run in Code Playground, I guess you know Code Playground doesn't support interactive input mode, all input must be supplied in the input dialog, all at once : )
Hth, cmiiw