Check out example codes for "how to make a c++ iostream program restart when finished". It will help you in understanding the concepts better.

Code Example 1

if (whatever condition)
    correct();
else
{
    incorrect();
    cout << "Enter y to restart: ";
    char c;
    cin >> c;
    if (c == 'y')
        continue;
    else
        return 1;
}

Learn ReactJs, React Native from akashmittal.com