0
How to run code again without return 0?
What do I do if I want a code to start from the beginning again without return 0 (without a loop)? Is it just a simple command?
1 Answer
+ 1
Just make a recursive function with the code you want to return to the beginning to. Main cannot be recursive hence the creation of a different function.
Example:
void sayhi()
{
cout << "hi";
sayhi()
}
int main()
{
sayhi();
}