Hi. I've got a question about a return statment and an exit() function. Here's the code:

NOTE: this is a member function of a fraction class that converts the fraction to lowest terms. as you might have guessed, *den is denominator and *num is numerator and gcd is greatest common divisor.

Code:

void fraction::lowterms()
{
long tnum, tden, temp, gcd;
tnum = labs(num);
tden = labs(den);
if( tnum!=0 && tden==0 )
{ cout << "Illegal fraction: devision by 0"; exit(1); } // <--PROBLEM HERE!!!!!
else if( tnum==0 )
{ num=0; den = 1; return; } // <--PROBLEM HERE!!!!!
//...goes on to convert to lowest terms...
}

Now for the quetsions

1) I was taught that you use a return statment to return something to whatever is calling it. The return statement in the if statement just uses the keyword without anything following it. What does this mean?

2) I used exit() before to terminate a program, and was taught that 0 should be used to assure a successful termination. But the exit() function in the if statement uses a value of 1 for the argument. What does this mean?

I am using a Borland 5.5, so some of the functions may seem odd, but i'm not sure. the labs() function returns the absolute value of the supplied number.