summaryrefslogtreecommitdiff
path: root/Practical_C_Programming/Chapter_21_1.ipynb
blob: 144ac4539ad1086565c5483414a265a41a9bbb3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
 "metadata": {
  "name": "",
  "signature": "sha256:519d4be291344b242a6ae999f129aea597642f5315e1fe947ec2b9d627dcc018"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 21: C's dustier corners"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 21.1, Page number: 401"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variable declaration\n",
      "import sys\n",
      "line = 'a'\n",
      "\n",
      "# Calculation and result\n",
      "if (line == 'a') :\n",
      "   print ('Add\\n')\n",
      "elif (line == 'd') :\n",
      "   print ('Delete\\n')\n",
      "elif (line == 'q') :\n",
      "   print ('Quit\\n')\n",
      "   sys.exit(1)   \n",
      "else :\n",
      "   print ('Error:Bad command %c\\n' % line)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Add\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}