How to quit a C++ program?

Janusz picture Janusz · Jul 12, 2009 · Viewed 134.6k times · Source

I would like my C++ code to stop running if a certain condition is met, but I'm not sure how to do that. So just at any point if an if statement is true terminate the code like this:

if (x==1)
{
    kill code;
}

Answer