summaryrefslogtreecommitdiff
path: root/Programming_in_C/Chapter_11.ipynb
diff options
context:
space:
mode:
authordebashisdeb2014-06-20 15:42:42 +0530
committerdebashisdeb2014-06-20 15:42:42 +0530
commit83c1bfceb1b681b4bb7253b47491be2d8b2014a1 (patch)
treef54eab21dd3d725d64a495fcd47c00d37abed004 /Programming_in_C/Chapter_11.ipynb
parenta78126bbe4443e9526a64df9d8245c4af8843044 (diff)
downloadPython-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.tar.gz
Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.tar.bz2
Python-Textbook-Companions-83c1bfceb1b681b4bb7253b47491be2d8b2014a1.zip
removing problem statements
Diffstat (limited to 'Programming_in_C/Chapter_11.ipynb')
-rw-r--r--Programming_in_C/Chapter_11.ipynb68
1 files changed, 0 insertions, 68 deletions
diff --git a/Programming_in_C/Chapter_11.ipynb b/Programming_in_C/Chapter_11.ipynb
index a010bcdb..76ced362 100644
--- a/Programming_in_C/Chapter_11.ipynb
+++ b/Programming_in_C/Chapter_11.ipynb
@@ -27,10 +27,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.1.py\n",
- "#Illustrating Pointers\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -42,7 +39,6 @@
" #Result\n",
" print(\"count={0} , x={1}\".format(count,x))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -71,10 +67,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.2.py\n",
- "#More Pointer Basics\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -92,7 +85,6 @@
"\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -123,10 +115,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.3\n",
- "#Using Pointers in Expressions\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -138,7 +127,6 @@
" #Result\n",
" print(\"i1 = {0}, i2 = {1}, p1 = {2}, p2 = {3}\\n\".format(i1, i2, p1, p2))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -168,10 +156,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.4.py\n",
- "#Using Pointers to classes\n",
"\n",
- "#Main()\n",
"def main():\n",
" class date:\n",
" def __init__(self): #Class constructor\n",
@@ -190,7 +175,6 @@
" #Result\n",
" print(\"Today's date is {0}/{1}/{2}\".format(datePtr.month, datePtr.day, datePtr.year))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -219,10 +203,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.5.py\n",
- "#Using classes Containing pointer variables\n",
"\n",
- "#Main()\n",
"def main():\n",
" class intPtrs:\n",
" def __init__(self): #Class constructor\n",
@@ -241,7 +222,6 @@
" print(\"i2 = {0}, pointers.p2 = {1}\\n\".format(i2, pointers.p2))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -273,11 +253,8 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.6.py\n",
- "#Using Linked Lists\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
" class entry:\n",
" def __init(self): #Class constructor\n",
@@ -303,7 +280,6 @@
"\n",
"\n",
"\n",
- "#setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -333,10 +309,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.7.py\n",
- "#Traversing a linked list\n",
"\n",
- "#Main()\n",
"def main():\n",
" class entry:\n",
" def __init__(self): #Class constructor\n",
@@ -362,7 +335,6 @@
" list_pointer = list_pointer.nxt;\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -396,15 +368,11 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.8.py\n",
- "#Using Pointers and Functions\n",
"\n",
- "#Function to change incoming varible\n",
"def test(int_pointer):\n",
" int_pointer=100\n",
" return int_pointer\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable declaration\n",
@@ -417,7 +385,6 @@
" print(\"After the call to test i = {0}\".format(p))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -447,10 +414,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.9.py\n",
- "#Using Pointers to Exchange Values\n",
"\n",
- "#Function to exchange & return values\n",
"def exchange(pint1,pint2):\n",
" temp=pint1\n",
" pint1=pint2\n",
@@ -458,7 +422,6 @@
" return pint1,pint2\n",
"\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Variable Declaration\n",
@@ -478,7 +441,6 @@
" print(\"i1 ={0}, i2 ={1}\\n\".format(i1, i2))\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -512,10 +474,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.10.py\n",
- "#Returning a Pointer from a Function\n",
"\n",
- "#Class Declaration\n",
"class entry:\n",
" def __init__(self): #Class constructor\n",
" self.value=0\n",
@@ -532,7 +491,6 @@
"\n",
" return 0\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #Creating instance\n",
@@ -562,7 +520,6 @@
" print(\"Not found.\\n\")\n",
"\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -593,10 +550,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.11.py\n",
- "#Working with Pointers to Arrays/Lists\n",
"\n",
- "#Function to evaluate sum of array elements\n",
"def arraySum (array,n):\n",
"\n",
" #Variable Declaration\n",
@@ -607,7 +561,6 @@
" sum += array[i]\n",
" return sum\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List Declaration\n",
@@ -615,7 +568,6 @@
" #Result\n",
" print(\"The sum is {0}\\n\".format(arraySum (values, 10)))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -645,10 +597,7 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.12.py\n",
- "#Summing the Elements of an Array--version 2\n",
"\n",
- "#Function to evaluate sum of array elements\n",
"def arraySum (array,n):\n",
" #Variable Declaration\n",
" sum = 0 \n",
@@ -657,7 +606,6 @@
" sum += i\n",
" return sum\n",
"\n",
- "#Main()\n",
"def main():\n",
"\n",
" #List Declaration\n",
@@ -665,7 +613,6 @@
" #Result\n",
" print(\"The sum is {0}\\n\".format(arraySum(values,10)))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -695,16 +642,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.13.py\n",
- "#Version of copyString\n",
"\n",
- "#Function to copy string from source to destinaton\n",
"def copyString(to, frm):\n",
" global string2\n",
" to=frm\n",
" string2=to\n",
"\n",
- "#Main()\n",
"def main():\n",
" \n",
" global string2\n",
@@ -717,7 +660,6 @@
" copyString (string2, \"So is this.\") #Function call\n",
" print(\"{0}\\n\".format(string2))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -749,16 +691,12 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.14.py\n",
- "#Revised version of copyString\n",
"\n",
- "#Function to copy string from source to destinaton\n",
"def copyString(to, frm):\n",
" global string2\n",
" to=frm\n",
" string2=to\n",
"\n",
- "#Main()\n",
"def main():\n",
" \n",
" global string2\n",
@@ -771,7 +709,6 @@
" copyString (string2, \"So is this.\") #Function call\n",
" print(\"{0}\\n\".format(string2))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],
@@ -803,20 +740,15 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "#11.15.PY\n",
- "#Find the Length of a String\n",
"\n",
- "#Function to return string length\n",
"def stringLength(string):\n",
" return len(string) #Calculation\n",
"\n",
- "#Main()\n",
"def main():\n",
" print(\"{0} \".format(stringLength (\"stringLength test\")))\n",
" print(\"{0} \".format(stringLength (\"\")))\n",
" print(\"{0}\".format(stringLength (\"complete\")))\n",
"\n",
- "#Setting top level conditional script\n",
"if __name__=='__main__':\n",
" main()"
],