Example
void write_sqrt( double x)
// Precondition: x >= 0.
// Postcondition: The square root of x has
// been written to the standard output.
{
assert(x >= 0);
...
The assert function (described in Section 1.1) is useful for detecting violations of a precondition.
Previous slide
Next slide
Back to first slide
View graphic version