source: trunk/testapp/exceptions/condexc.cpp@ 10367

Last change on this file since 10367 was 5442, checked in by sandervl, 24 years ago

* empty log message *

File size: 598 bytes
Line 
1// This example illustrates a conditional expresion
2// used as a throw expression.
3
4#include <iostream.h>
5void main() {
6 int doit = 1;
7 int dont = 0;
8 float f = 8.9;
9 int i = 7;
10 int j = 6;
11 try { throw(doit ? i : f); }
12 catch (int x)
13 {
14 cout << "Caught int " << x << endl;
15 }
16 catch (float x)
17 {
18 cout << "Caught float " << x << endl;
19 }
20 catch (double x)
21 {
22 cout << "Caught double " << x << endl;
23 }
24 catch (...)
25 {
26 cout << "Caught something " << endl;
27 }
28}
29
Note: See TracBrowser for help on using the repository browser.