How to tell the program to end in C++?

May 5, 2012 at 10:58pm
I have an if statement and if the statement is true, I want the program to end. Please keep in mind, I'm using XCode, so some stuff might not work.

ex:
1
2
3
4
5
6
int main()
{
     int x=1;   
     if(x=1)
         ______________
}

The blank is where I want the program to end.
Last edited on May 7, 2012 at 2:16am
May 5, 2012 at 11:03pm
The program will end automatically when the main function ends so no need to to do anything in this case.
May 5, 2012 at 11:11pm
I know that, but if there was more code at the end, how would I end the program there.
May 5, 2012 at 11:41pm
return 0;
Topic archived. No new replies allowed.