home *** CD-ROM | disk | FTP | other *** search
- // \EXAMPLES\EX0421.CPP
- // This is not an example of a preferred programming style.
- // It is just an example of using labels.
- #include <iostream.h>
-
- const int size = 3;
-
- int num[size][size] = {{2, 2, 4},
- {3, 4, 5},
- {1, 0, 2}};
-
- void main() {
- for (int i = 0; i < size; i++) {
- for (int j = 0; j < size; j++) {
- if ( num[i][j] == 0)
- goto div_zero; // get out of both loops
- cout << "Result is :" << num[j][i]/ num[i][j] << endl;
- }
- }
- goto END;
- div_zero: cout << "incomplete" // print error message
- << endl;
- END:;
- }
-