If Exceptions than?

The most common means of error checking is the function’s return value.
Consider the problem of calculating the retail cost of an item and displaying it. For this example, the retail cost is twice the wholesale cost:

int retailCost( int wholesale )
{
if ( wholesale <= 0 )
{
return 0 ;
}
return (wholesale * 2 ) ;
}

The retailCost() method takes the wholesale price of an item and doubles it. If the wholesale price is negative or zero, the function returns zero to indicate that an error has occurred.