Yurttas/PL/OOL/Cplusplus/F/02/06/02/exception 02.cpp

From ZCubes Wiki
Revision as of 22:45, 6 November 2013 by MassBot1 (talk | contribs) (Created page with "<syntaxhighlight lang="cpp" line start="1" enclose="div">/* Copyright(C) 2000 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc.. Perm...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
 1/*
 2   Copyright(C) 2000
 3   All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4
 5   Permission to use, copy, modify, and distribute this
 6   software and its documentation for EDUCATIONAL purposes
 7   and without fee is hereby granted provided that this
 8   copyright notice appears in all copies.
 9
10   date   : January 1, 2000.
11   author : Salih Yurttas.
12
13   exception_02.cpp
14*/
15
16
17#include <iostream>
18#include <cctype>
19
20using namespace std;
21
22#include "Thrower.h"
23
24enum IDC {Integer='I',
25          Double='D',
26          Character='C'};
27
28typedef enum IDC IDC;
29
30int main(int argc, char* argv[]) {
31
32  char decision;
33
34  cout << "Enter a decision value as character I | D | C : ";
35  cin >> decision;
36
37  switch((IDC)(toupper(decision))) {
38    case Integer : {
39      int value; 
40
41      cout << "Enter an int value : " ;
42      cin >> value;
43
44      Thrower().thrower(value); // unhandled exception 
45    }
46    break;
47
48    case Double : {
49      double value; 
50
51      cout << "Enter a double value : " ;
52      cin >> value;
53
54      Thrower().thrower(value); // unhandled exception 
55    }
56    break;
57
58    case Character : {
59      char value; 
60
61      cout << "Enter a char value : " ;
62      cin >> value;
63
64      Thrower().thrower(value); // unhandled exception 
65    }
66  }
67
68}