poj–1979 Red and Black

Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can’t move on red tiles, he can move only on black tiles.  Write a program to count the number of black tiles which he can reach by repeating the moves described above.  Input The input consists of multiple data sets. A data set starts with a line containing two positive integers W and H; W and H are the numbers of tiles in the x- and y- directions, respectively. W and H are not m...

Read Primer] 39.<5.6>try statement block and exception handling Page172

Exceptions, the program detects the current situation and will run exceptionally when it exceeds its processing power. For example, common exceptions have zero dividing problems, database connection loss input needs a number of cases given alphabetic input Typical exception handling consists of the following sections: try blocks, statements that might be abnormal are placed in try blocks, an exception type is the parameter in the catch bracket, and different types are used to determine different exceptions try{ program-statements }catch(exception-declaration){ handler-statments }ca...