What you need is a loop.
C++ has various different loop constructs - while, do-while, for.
Check out the while loop, which goes along the lines,
1 2 3 4 5
|
while (<condition>)
{
... do stuff
}
|
This repeatedly
does stuff until the <condition> in the while statement evaluates as true.
So using a while loop, your condition could be a simple bool called
keepLooping, for example, which you set = true if the user enters "exit" to a prompt within the loop.
As an aside - calling a function from within itself, for example main() from within main(), is called
recursion and is
not the way to perform simple loops. You can read up on recursion if you want, but I suspect it's a topic for the future.
Have a go at the loop and let us know how you go!
Oh, and the cmd console will close if you exit the program. If you want the console to hang around so you can see any results before it closes, you can add a final call to a read-line function, such as getch() or read from cin - anything that requires the user to provide input and so pauses execution.
Cheers,
Jim