summaryrefslogtreecommitdiff
path: root/C++_from_the_Ground/Chapter_18(1).ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'C++_from_the_Ground/Chapter_18(1).ipynb')
-rw-r--r--C++_from_the_Ground/Chapter_18(1).ipynb50
1 files changed, 20 insertions, 30 deletions
diff --git a/C++_from_the_Ground/Chapter_18(1).ipynb b/C++_from_the_Ground/Chapter_18(1).ipynb
index e2cae07f..df4cabc2 100644
--- a/C++_from_the_Ground/Chapter_18(1).ipynb
+++ b/C++_from_the_Ground/Chapter_18(1).ipynb
@@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
- "signature": "sha256:3dbb4b61b32533eb72607c7c790e9f8f91b9c2e123ddbd5190ffe13a1b2b7647"
+ "signature": "sha256:85eae8322c208f1f26e859bb0f4dac6f86b35c3ac105ed98ac2d0fbf05287f0e"
},
"nbformat": 3,
"nbformat_minor": 0,
@@ -410,11 +410,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\n",
- "#Open a file, creating one if it does not already exist\n",
+ " \n",
"out=open(\"test\",'w')\n",
"\n",
- "#In case file cannot open\n",
+ "\n",
"if(not(out)):\n",
" print \"Cannot open file.\"\n",
"else:\n",
@@ -441,10 +440,9 @@
"collapsed": false,
"input": [
"\n",
- "#Open a file, creating one if it does not already exist\n",
+ " \n",
"In=open(\"test\",'r')\n",
- "\n",
- "#In case file cannot open\n",
+ " \n",
"if(not(In)):\n",
" print \"Cannot open file.\"\n",
"else:\n",
@@ -668,27 +666,24 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\n",
- "#creating test1\n",
+ " \n",
"out=open(\"test1\",'w')\n",
"out.write(\"Hello\")\n",
"out.close()\n",
- "\n",
- "#creating test2\n",
+ " \n",
"out=open(\"test2\",'w')\n",
"out.write(\"There\")\n",
"out.close()\n",
"\n",
- "\n",
- "#Open test1\n",
+ " \n",
"f1=open(\"test1\",'r')\n",
- "#In case file cannot open\n",
+ " \n",
"if(not(In)):\n",
" print \"Cannot open file.\"\n",
"\n",
- "#Open test2\n",
+ " \n",
"f2=open(\"test2\",'r')\n",
- "#In case file cannot open\n",
+ " \n",
"if(not(In)):\n",
" print \"Cannot open file.\"\n",
" \n",
@@ -703,7 +698,7 @@
" f1.close()\n",
" f2.close()\n",
"else:\n",
- " #compare contents of buffers\n",
+ " \n",
" flag=1\n",
" for i in range(len(buf1)):\n",
" if not(buf1[i]==buf2[i]):\n",
@@ -745,8 +740,7 @@
"input": [
"\n",
"print \"Enter your name:\"\n",
- "\n",
- "#User imput\n",
+ " \n",
"str=\"hello world\"\n",
"\n",
"print str"
@@ -776,13 +770,10 @@
"cell_type": "code",
"collapsed": false,
"input": [
- "\n",
- "#Open test\n",
- "out=open(\"test\",'r+b')\n",
+ " out=open(\"test\",'r+b')\n",
"out.write(\"Hello\")\n",
"\n",
- "\n",
- "#In case file cannot open\n",
+ " \n",
"if(not(out)):\n",
" print \"Cannot open file.\"\n",
"else:\n",
@@ -808,13 +799,13 @@
"collapsed": false,
"input": [
"\n",
- "#Open test\n",
+ " \n",
"out=open(\"test\",'r+b')\n",
"out.write(\"Hello\")\n",
"out.close()\n",
"\n",
"In=open(\"test\",'r')\n",
- "#In case file cannot open\n",
+ " \n",
"if(not(In)):\n",
" print \"Cannot open file.\"\n",
"else:\n",
@@ -857,14 +848,13 @@
" c=(\"%d\"%self.__x)+\", \"+(\"%d\"%self.__y)+\", \"+(\"%d\"%self.__z)+\"\\n\"\n",
" return c \n",
"\n",
- "#Variable declaration\n",
+ " \n",
"a=three_d(1,2,3)\n",
"b=three_d(3,4,5)\n",
"c=three_d(5,6,7)\n",
- "\n",
- "#Open threed\n",
+ " \n",
"out=open(\"threed\",'w')\n",
- "#In case file cannot open\n",
+ " \n",
"if(not(out)):\n",
" print \"Cannot open file.\"\n",
"else:\n",