Merge pull request 'save' (#15) from save into master

master
mac76tib2 2 years ago
commit a36dd3ecc3

@ -418,6 +418,6 @@ C9:Reader* LendBook(Reader* reader, Book* book);\\读者借书
C10:void returnBook(Reader* reader, Book* book);\\读者还书 C10:void returnBook(Reader* reader, Book* book);\\读者还书
![C10](images/returnBook.svg) ![C10](images/returnBook.svg)
C11:void save(Book* book);\\文件保存 C11:void save(Book* book);\\文件保存
![C11](images/save.svg)
C12:Book* read1();\\从文件读取 C12:Book* read1();\\从文件读取

@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created by Flowgorithm 3.4.2 (http://flowgorithm.org) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="2196" height="5436">
<rect x="0" y="0" width="2196" height="5436" fill="#FFFFFF"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,288 828,375"/>
<polygon fill="#404040" stroke="none" points="828,396 848,361 807,361"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,5040 828,5127"/>
<polygon fill="#404040" stroke="none" points="828,5148 848,5113 807,5113"/>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 684,144 A 72 72, 0, 0 0, 684 288 L 972,288 A 72 72, 0, 0 0, 972 144 Z"/>
<text x="828" y="165" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">&#24320;&#22987;</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 684,5148 A 72 72, 0, 0 0, 684 5292 L 972,5292 A 72 72, 0, 0 0, 972 5148 Z"/>
<text x="828" y="5169" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">&#32467;&#26463;</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,540 828,627"/>
<polygon fill="#404040" stroke="none" points="828,648 848,613 807,613"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,792 828,879"/>
<polygon fill="#404040" stroke="none" points="828,900 848,865 807,865"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,1656 828,1743"/>
<polygon fill="#404040" stroke="none" points="828,1764 848,1729 807,1729"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,3168 828,3291"/>
<polygon fill="#404040" stroke="none" points="828,3312 848,3277 807,3277"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,3456 828,4227"/>
<polygon fill="#404040" stroke="none" points="828,4248 848,4213 807,4213"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,4392 828,4479"/>
<polygon fill="#404040" stroke="none" points="828,4500 848,4465 807,4465"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="828,4788 828,4875"/>
<polygon fill="#404040" stroke="none" points="828,4896 848,4861 807,4861"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 468,396 L 468,540 L 1188,540 L 1188,396 Z"/>
<text x="828" y="417" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">Book* pCur = book1</tspan>
</text>
</g>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" d="M 612,648 L 612,792 L 1044,792 L 1044,648 Z"/>
<text x="828" y="669" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">iCount = 0</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1116,1080 1404,1080 1404,1311"/>
<polygon fill="#404040" stroke="none" points="1404,1332 1424,1297 1383,1297"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1404,1476 1404,1620 884,1620"/>
<polygon fill="#404040" stroke="none" points="864,1620 898,1640 898,1599"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="540,1080 360,1080 360,1620 771,1620"/>
<polygon fill="#404040" stroke="none" points="792,1620 757,1599 757,1640"/>
<g>
<path fill="#FFD0D0" stroke="#A07070" stroke-width="5" stroke-dasharray="none" d="M 828,900 L 504,1080 L 828,1260 L 1152,1080 Z"/>
<text x="828" y="1029" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">pCur == NULL</tspan>
</text>
</g>
<g>
<path fill="#D0FFD0" stroke="#70A070" stroke-width="5" stroke-dasharray="none" d="M 972,1332 L 900,1476 L 1836,1476 L 1908,1332 Z"/>
<text x="1404" y="1353" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1404" dy="72" unicode-bidi="embed">&#36755;&#20986; (&quot;\n &#27809;&#26377;&#23398;&#29983;&#35760;&#24405;!\n&quot;)</tspan>
</text>
</g>
<g>
</g>
<ellipse cx="828" cy="1620" rx="36" ry="36" fill="#FFD0D0" stroke="#A07070" stroke-width="5"/>
<text x="1224" y="957" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1224" dy="72" unicode-bidi="embed">&#30495;</tspan>
</text>
<text x="432" y="957" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="432" dy="72" unicode-bidi="embed">&#20551;</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1296,2016 1476,2016 1476,2319"/>
<polygon fill="#404040" stroke="none" points="1476,2340 1496,2305 1455,2305"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1476,2988 1476,3132 884,3132"/>
<polygon fill="#404040" stroke="none" points="864,3132 898,3152 898,3111"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="360,2016 180,2016 180,3132 771,3132"/>
<polygon fill="#404040" stroke="none" points="792,3132 757,3111 757,3152"/>
<g>
<path fill="#FFD0D0" stroke="#A07070" stroke-width="5" stroke-dasharray="none" d="M 828,1764 L 324,2016 L 828,2268 L 1332,2016 Z"/>
<text x="828" y="1929" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">(fp = fopen(&quot;book.txt&quot;,</tspan>
<tspan x="828" dy="72" unicode-bidi="embed"> &quot;wb&quot;)) == NULL</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1476,2484 1476,2571"/>
<polygon fill="#404040" stroke="none" points="1476,2592 1496,2557 1455,2557"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1476,2736 1476,2823"/>
<polygon fill="#404040" stroke="none" points="1476,2844 1496,2809 1455,2809"/>
<g>
<path fill="#D0FFD0" stroke="#70A070" stroke-width="5" stroke-dasharray="none" d="M 1080,2340 L 1008,2484 L 1872,2484 L 1944,2340 Z"/>
<text x="1476" y="2361" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1476" dy="72" unicode-bidi="embed">&#36755;&#20986; (&quot;&#21019;&#24314;&#25991;&#20214;&#22833;&#36133;!\n&quot;)</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 1260,2592 L 1260,2736 L 1692,2736 L 1692,2592 Z"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="1296,2592 1296,2736"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="1656,2592 1656,2736"/>
<text x="1476" y="2613" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1476" dy="72" unicode-bidi="embed">getchar()</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 1260,2844 L 1260,2988 L 1692,2988 L 1692,2844 Z"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="1296,2844 1296,2988"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="1656,2844 1656,2988"/>
<text x="1476" y="2865" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1476" dy="72" unicode-bidi="embed">exit(1)</tspan>
</text>
</g>
</g>
<g>
</g>
<ellipse cx="828" cy="3132" rx="36" ry="36" fill="#FFD0D0" stroke="#A07070" stroke-width="5"/>
<text x="1404" y="1893" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1404" dy="72" unicode-bidi="embed">&#30495;</tspan>
</text>
<text x="252" y="1893" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="252" dy="72" unicode-bidi="embed">&#20551;</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1044,3384 1548,3384 1548,3507"/>
<polygon fill="#404040" stroke="none" points="1548,3528 1568,3493 1527,3493"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1548,3996 1548,4104 900,4104 900,3476"/>
<polygon fill="#404040" stroke="none" points="900,3456 879,3490 920,3490"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1548,3744 1548,3831"/>
<polygon fill="#404040" stroke="none" points="1548,3852 1568,3817 1527,3817"/>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 1044,3528 L 1044,3744 L 2052,3744 L 2052,3528 Z"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="1080,3528 1080,3744"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="2016,3528 2016,3744"/>
<text x="1548" y="3549" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1548" dy="72" unicode-bidi="embed">fwrite(pCur, sizeof(Book), 1,</tspan>
<tspan x="1548" dy="72" unicode-bidi="embed"> fp)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 1224,3852 L 1224,3996 L 1872,3996 L 1872,3852 Z"/>
<text x="1548" y="3873" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1548" dy="72" unicode-bidi="embed">pCur = pCur-&gt;next</tspan>
</text>
</g>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="5" stroke-dasharray="none" d="M 684,3312 L 612,3384 L 684,3456 L 972,3456 L 1044,3384 L 972,3312 Z"/>
<text x="828" y="3333" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">pCur</tspan>
</text>
</g>
<text x="1116" y="3261" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1116" dy="72" unicode-bidi="embed">&#30495;</tspan>
</text>
<text x="756" y="3477" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="756" dy="72" unicode-bidi="embed">&#20551;</tspan>
</text>
</g>
<g>
<path fill="#D0FFD0" stroke="#70A070" stroke-width="5" stroke-dasharray="none" d="M 648,4248 L 576,4392 L 1008,4392 L 1080,4248 Z"/>
<text x="828" y="4269" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">&#36755;&#20986; &quot;\n&quot;</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 396,4500 L 252,4788 L 1260,4788 L 1404,4500 Z"/>
<text x="828" y="4521" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">&#36755;&#20986;</tspan>
<tspan x="828" dy="72" unicode-bidi="embed"> (&quot;&#20445;&#23384;&#25991;&#20214;&#30340;&#25968;&#25454;&#25968;&#30446;&#20026;:%</tspan>
<tspan x="828" dy="72" unicode-bidi="embed">d\n&quot;,iCount)</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 612,4896 L 612,5040 L 1044,5040 L 1044,4896 Z"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="648,4896 648,5040"/>
<polyline fill="none" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" points="1008,4896 1008,5040"/>
<text x="828" y="4917" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="828" dy="72" unicode-bidi="embed">fclose(fp)</tspan>
</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

Loading…
Cancel
Save