I've found this code and I don't understand why they end the program with exit(0) when the input is not valid. Why they didn't use exit(1)? I've heard that we should use exit(1) when there is a failure. So when I should use EXIT_FAILURE or EXIT_SUCCESS?
#include<iostream>
using namespace std;
int main()
{
int i;
cout<<"Enter a non-zero value: "; //user input
cin>>i;
if(i) // checks whether the user input is non-zero or not
{
cout<<"Valid input.\n";
}
else
{
cout<<"ERROR!"; //the program exists if the value is 0
exit(0);
}
cout<<"The input was : "<<i;
}