commit
e33071f8ee
@ -0,0 +1,277 @@
|
||||
<mxfile host="65bd71144e">
|
||||
<diagram id="0iwV3ipOlTaEYRU5HPaa" name="Page-1">
|
||||
<mxGraphModel dx="1824" dy="1701" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
|
||||
<root>
|
||||
<mxCell id="0"/>
|
||||
<mxCell id="1" parent="0"/>
|
||||
<mxCell id="5" value="" style="edgeStyle=none;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="3" target="4" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="17" value="" style="edgeStyle=none;html=1;fillColor=#60a917;strokeColor=#2D7600;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="3" target="4" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="18" style="edgeStyle=none;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#60a917;strokeColor=#2D7600;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="3" target="7" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="280" y="320" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="280" y="320"/>
|
||||
<mxPoint x="280" y="180"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="19" style="edgeStyle=none;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#60a917;strokeColor=#2D7600;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="3" target="13" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="280" y="320"/>
|
||||
<mxPoint x="280" y="460"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="20" style="edgeStyle=none;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#60a917;strokeColor=#2D7600;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="3" target="15" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="280" y="320"/>
|
||||
<mxPoint x="280" y="600"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="21" style="edgeStyle=none;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;fillColor=#60a917;strokeColor=#2D7600;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="3" target="10" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="280" y="320"/>
|
||||
<mxPoint x="280" y="40"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="65" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="49" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="67" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="50" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="530" y="320" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="520" y="320"/>
|
||||
<mxPoint x="520" y="190"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="68" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="52" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="520" y="320"/>
|
||||
<mxPoint x="520" y="50"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="69" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="58" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="520" y="320"/>
|
||||
<mxPoint x="520" y="470"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="70" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="60" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="520" y="320"/>
|
||||
<mxPoint x="520" y="610"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="71" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="471" y="320" as="sourcePoint"/>
|
||||
<mxPoint x="581" y="750" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="521" y="320"/>
|
||||
<mxPoint x="521" y="750"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="72" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#d80073;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="54" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="520" y="320"/>
|
||||
<mxPoint x="520" y="-90"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="73" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;fillColor=#6a00ff;strokeColor=#4C0099;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;strokeWidth=3;" parent="1" source="3" target="56" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="520" y="320"/>
|
||||
<mxPoint x="520" y="-230"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="3" value="<h1 style="font-size: 30px;">main</h1>" style="rounded=0;whiteSpace=wrap;html=1;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1;fontSize=30;" parent="1" vertex="1">
|
||||
<mxGeometry x="350" y="290" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="4" value="<h2>make_choice</h2>" style="rounded=0;whiteSpace=wrap;html=1;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="290" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="7" value="<h2>display_menu</h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="150" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="10" value="<h2>init&nbsp;</h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="10" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="13" value="<h2>confirm</h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="430" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="15" value="<h2>quit&nbsp;</h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="120" y="570" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="78" style="edgeStyle=none;html=1;strokeColor=#B09500;fontColor=#f9f9f5;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fillColor=#e3c800;sketch=1;curveFitting=1;jiggle=2;strokeWidth=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="49" target="75" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="950" y="-190" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="960" y="320"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="49" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;"><font color="#f4f4f0">DoRepaidBook</font></h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="290" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="88" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#001DBC;fontColor=#f9f9f5;fillColor=#0050ef;sketch=1;curveFitting=1;jiggle=2;strokeWidth=3;fontFamily=Helvetica;fontStyle=1" parent="1" source="50" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="1000" y="-30" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="850" y="190"/>
|
||||
<mxPoint x="850" y="-30"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="50" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;"><font color="#f5f5f0">DoPrintBook</font></h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="160" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="76" style="edgeStyle=none;html=1;strokeColor=#B09500;fontColor=#f9f9f5;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fillColor=#e3c800;sketch=1;curveFitting=1;jiggle=2;strokeWidth=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="52" target="75" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="950" y="-190" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="960" y="50"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="87" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#001DBC;fontColor=#f9f9f5;fillColor=#0050ef;sketch=1;curveFitting=1;jiggle=2;strokeWidth=3;fontFamily=Helvetica;fontStyle=1" parent="1" source="52" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="1000" y="-30" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="850" y="50"/>
|
||||
<mxPoint x="850" y="-30"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="52" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;"><font color="#f7f7f2">DoDeleteBook</font></h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="20" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="77" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#B09500;fontColor=#f9f9f5;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fillColor=#e3c800;sketch=1;curveFitting=1;jiggle=2;strokeWidth=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="54" target="75" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="970" y="50" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="960" y="-90"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="86" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeColor=#001DBC;fontColor=#f9f9f5;fillColor=#0050ef;sketch=1;curveFitting=1;jiggle=2;strokeWidth=3;fontFamily=Helvetica;fontStyle=1" parent="1" source="54" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="1000" y="-30" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="850" y="-90"/>
|
||||
<mxPoint x="850" y="-30"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="95" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;jumpSize=6;html=1;strokeColor=#4D9900;strokeWidth=3;fontFamily=Helvetica;fontSize=30;fontColor=#FFFFFF;startSize=6;" parent="1" source="54" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="850" y="750" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="770" y="-90"/>
|
||||
<mxPoint x="770" y="750"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="54" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;"><font color="#d4d4d4">&nbsp;DoFindBook</font></h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="-120" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="83" style="edgeStyle=none;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#BD7000;fontColor=#f9f9f5;fillColor=#f0a30a;strokeWidth=2;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="56" target="82" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<Array as="points">
|
||||
<mxPoint x="810" y="-230"/>
|
||||
<mxPoint x="810" y="-340"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="85" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#001DBC;fontColor=#f9f9f5;fillColor=#0050ef;strokeWidth=2;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="700" y="-230" as="sourcePoint"/>
|
||||
<mxPoint x="1000" y="-30" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="850" y="-230"/>
|
||||
<mxPoint x="850" y="-30"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="56" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;"><font color="#f9f9f5">DoAddBook</font></h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="-260" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="79" style="edgeStyle=none;html=1;strokeColor=#B09500;fontColor=#f9f9f5;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fillColor=#e3c800;sketch=1;curveFitting=1;jiggle=2;strokeWidth=2;startSize=6;jumpSize=6;fontFamily=Helvetica;fontStyle=1" parent="1" source="58" target="75" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="970" y="50" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="960" y="470"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="92" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;jumpSize=6;html=1;strokeColor=#4D9900;strokeWidth=3;fontFamily=Helvetica;fontSize=30;fontColor=#FFFFFF;startSize=6;" parent="1" source="58" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="850" y="750" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="770" y="470"/>
|
||||
<mxPoint x="770" y="750"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="58" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;">DoBoorowBook</h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="440" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="80" style="edgeStyle=none;html=1;strokeColor=#B09500;fontColor=#f9f9f5;entryX=0.5;entryY=1;entryDx=0;entryDy=0;fillColor=#e3c800;sketch=1;curveFitting=1;jiggle=2;strokeWidth=2;fontFamily=Helvetica;fontStyle=1" parent="1" source="60" target="75" edge="1">
|
||||
<mxGeometry relative="1" as="geometry">
|
||||
<mxPoint x="970" y="50" as="targetPoint"/>
|
||||
<Array as="points">
|
||||
<mxPoint x="960" y="610"/>
|
||||
</Array>
|
||||
</mxGeometry>
|
||||
</mxCell>
|
||||
<mxCell id="60" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;"><font color="#f5f5f0">DoReviseBook</font></h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="580" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="90" style="edgeStyle=none;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;jumpSize=6;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#4D9900;strokeWidth=3;fontFamily=Helvetica;fontSize=30;fontColor=#FFFFFF;startSize=6;" parent="1" source="62" target="89" edge="1">
|
||||
<mxGeometry relative="1" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="62" value="<h2 style="background-color: rgb(30, 30, 30); font-size: 14px; line-height: 19px;">DoSortBook()</h2>" style="whiteSpace=wrap;html=1;rounded=0;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="580" y="720" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="75" value="<h2><span>find</span></h2>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#F0F0F0;fontColor=#f9f9f5;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="898" y="-250" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="82" value="<h2>input</h2>" style="rounded=0;whiteSpace=wrap;html=1;strokeColor=#F0F0F0;fontColor=#f9f9f5;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;fontStyle=1" parent="1" vertex="1">
|
||||
<mxGeometry x="898" y="-370" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="84" value="<h2>print</h2>" style="rounded=0;whiteSpace=wrap;html=1;fontStyle=1;sketch=1;curveFitting=1;jiggle=2;fontFamily=Helvetica;" parent="1" vertex="1">
|
||||
<mxGeometry x="1000" y="-60" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="89" value="<div style="background-color: rgb(30, 30, 30); font-family: Consolas, &quot;Courier New&quot;, monospace; font-size: 14px; line-height: 19px;"><h3 style="line-height: 19px;"><font color="#ffffff">bookempty</font></h3></div>" style="shape=process;whiteSpace=wrap;html=1;backgroundOutline=1;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontFamily=Helvetica;fontSize=30;" parent="1" vertex="1">
|
||||
<mxGeometry x="850" y="720" width="120" height="60" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="98" value="&nbsp;<br>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=30;fontFamily=Helvetica;fontColor=#FFFFFF;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;" parent="1" vertex="1">
|
||||
<mxGeometry x="-225" y="-65" width="30" height="50" as="geometry"/>
|
||||
</mxCell>
|
||||
<mxCell id="99" value="&nbsp;<br>" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;strokeColor=none;fillColor=none;fontSize=30;fontFamily=Helvetica;fontColor=#FFFFFF;sketch=1;hachureGap=4;jiggle=2;curveFitting=1;fontSource=https%3A%2F%2Ffonts.googleapis.com%2Fcss%3Ffamily%3DArchitects%2BDaughter;" parent="1" vertex="1">
|
||||
<mxGeometry x="585" y="1265" width="30" height="50" as="geometry"/>
|
||||
</mxCell>
|
||||
</root>
|
||||
</mxGraphModel>
|
||||
</diagram>
|
||||
</mxfile>
|
@ -1,231 +1,235 @@
|
||||
#ifndef DATA_H_INCLUDED
|
||||
#define DATA_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sqlist.h"
|
||||
|
||||
|
||||
struct Book {
|
||||
int id; // 编号
|
||||
string title; // 标题
|
||||
int number; // 数量
|
||||
};
|
||||
|
||||
SqList <Book> books;
|
||||
|
||||
// 函数声明
|
||||
bool bookempty(); // 书籍库判空
|
||||
void input(Book& b); // 输入一本书的信息
|
||||
void print(const Book& b);// 打印一本书的信息
|
||||
int find(int id); // 根据 id 查找图书 || 若找到,返回元素的位序,找不到时返回 0
|
||||
|
||||
void DoAddBook(); // 添加图书
|
||||
void DoFindBook(); // 查找图书
|
||||
void DoDeleteBook(); // 删除图书
|
||||
void DoPrintBook(); // 打印所有图书
|
||||
void DoRepaidBook(); // 归还图书
|
||||
void DoBoorowBook(); // 借用图书
|
||||
void DoReviseBook(); // 修改图书
|
||||
void DoSortBook(); // 排序图书
|
||||
|
||||
|
||||
// 输入一本书的信息
|
||||
void input(Book& b)
|
||||
{
|
||||
cout << "ID : ";
|
||||
cin >> b.id;
|
||||
cin.ignore(1024, '\n'); // skip rest chars of the line
|
||||
cout << "TITLE : ";
|
||||
getline(cin, b.title);
|
||||
cout << "Number : ";
|
||||
while (1){
|
||||
cin >> b.number;
|
||||
if (b.number>0) break;
|
||||
cout << "Number ERROR" << endl;
|
||||
cout << "Input again" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// 打印一本书的信息
|
||||
void print(const Book& b)
|
||||
{
|
||||
cout << "Book " << endl << endl
|
||||
<<"**************** id: " << b.id << " ****************" << endl
|
||||
<< "**** title: 《 " << b.title << " 》****" << endl
|
||||
<< "************** Number: " << b.number << " **************" << endl << endl;
|
||||
}
|
||||
|
||||
// 根据 id 查找图书
|
||||
// 若找到,返回元素的位序,找不到时返回 0
|
||||
int find(int id)
|
||||
{
|
||||
|
||||
for (int i = 1; i <= books.length; i++)
|
||||
{
|
||||
if (id == books.elem[i].id){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0; // not found
|
||||
}
|
||||
|
||||
// 书籍库判空
|
||||
bool bookempty()
|
||||
{
|
||||
int a=0;
|
||||
for (int i=1;i<=books.length;i++)
|
||||
{
|
||||
if (find(i)==0) a++;
|
||||
}
|
||||
if (a==books.length) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
// 添加图书
|
||||
void DoAddBook()
|
||||
{
|
||||
cout << endl << "Add Book"<< endl<<endl;
|
||||
Book book;
|
||||
input(book); //输入图书
|
||||
books.elem[books.length + 1] = book;
|
||||
books.length++;
|
||||
print(book);
|
||||
cout << "*******Added********" << endl;
|
||||
}
|
||||
|
||||
// 查找图书
|
||||
void DoFindBook()
|
||||
{
|
||||
cout << endl << "Find Book" << endl <<endl;
|
||||
int id;
|
||||
cout << "Enter book ID: ";
|
||||
cin >> id;
|
||||
|
||||
Book book;
|
||||
if (find(id) == 0)
|
||||
cout << "Not found" << endl;
|
||||
else
|
||||
{
|
||||
book = books.elem[find(id)];
|
||||
cout << "Found" << endl;
|
||||
cout << "************" << endl;
|
||||
print(book);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除图书
|
||||
void DoDeleteBook()
|
||||
{
|
||||
cout << endl << "Delete Book" << endl << endl;
|
||||
int id;
|
||||
cout << "Which book you wanna delelet?"<<endl;
|
||||
cout << "Enter book ID: ";
|
||||
cin >> id;
|
||||
Book e;
|
||||
if (find(id) == 0)
|
||||
cout << "Not found" << endl;
|
||||
else
|
||||
{
|
||||
e = books.elem[find(id)];
|
||||
print(e);
|
||||
for (int i = find(id); i < books.length; i++)
|
||||
{
|
||||
books.elem[i] = books.elem[i + 1];
|
||||
}
|
||||
--books.length;
|
||||
cout << "************************" << endl;
|
||||
cout << "Deleted" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// 打印所有图书
|
||||
void DoPrintBook()
|
||||
{
|
||||
cout << endl << "Print All Books" << endl <<endl;
|
||||
int flag = 0;
|
||||
for (int i = 0; i < books.length; i++)
|
||||
{
|
||||
Book e;
|
||||
e = books.elem[i + 1];
|
||||
print(e);
|
||||
flag++;
|
||||
}
|
||||
cout << "Total: ";
|
||||
cout << flag;
|
||||
cout << " books" << endl;
|
||||
}
|
||||
|
||||
// 归还图书
|
||||
void DoRepaidBook()
|
||||
{
|
||||
cout << endl << "Repaid Book" << endl<<endl;
|
||||
int id;
|
||||
cout << "Which book you wanna repaid ? " << endl;
|
||||
cin >> id;
|
||||
cout << endl;
|
||||
if (find(id)){
|
||||
Book e;
|
||||
e = books.elem[find(id)];
|
||||
++books.elem[find(id)].number;
|
||||
}else{
|
||||
DoAddBook();
|
||||
}
|
||||
}
|
||||
|
||||
// 借用图书
|
||||
void DoBoorowBook()
|
||||
{
|
||||
cout << endl << "Boorow Book" << endl <<endl;
|
||||
int id;
|
||||
cout << "Which book you wanna boorow ? " << endl;
|
||||
cin >> id;
|
||||
cout << endl;
|
||||
if (find(id)){
|
||||
if (books.elem[find(id)].number>0) {
|
||||
Book e;
|
||||
e = books.elem[find(id)];
|
||||
cout<< "*********"<< endl << "OK" << endl << "*********"<<endl;
|
||||
--books.elem[find(id)].number;
|
||||
}else cout << "***************************"<< endl
|
||||
<< "Book empty" << endl << "***************************" << endl;
|
||||
}else cout<< "NOT FOUND THIS BOOK"<<endl;
|
||||
}
|
||||
|
||||
// 修改图书
|
||||
void DoReviseBook()
|
||||
{
|
||||
cout <<endl<< "Revise Book" <<endl <<endl;
|
||||
int id;
|
||||
printf( "Which book you wanna revise ?\n" );
|
||||
cin >> id;
|
||||
|
||||
if ( find(id)!=0 ) {
|
||||
printf ( "Original book number : %d\n", books.elem[id].number );
|
||||
printf ( "Revised number :" );
|
||||
int xiugai;
|
||||
scanf ( "%d", &xiugai );
|
||||
books.elem[id].number+=xiugai;
|
||||
cout << "**********************" << endl;
|
||||
printf ( "Revise success \n" );
|
||||
}
|
||||
else printf ( "No such book\n");
|
||||
}
|
||||
|
||||
// 排序图书
|
||||
void DoSortBook()
|
||||
{
|
||||
cout << endl << "Sort Books" << endl << endl;
|
||||
int a=0;
|
||||
if (bookempty()) cout << "Book data empty"<< endl;
|
||||
else {
|
||||
for (int i=1;i<books.length;i++)
|
||||
for (int j=books.length;j>0;j--)
|
||||
{
|
||||
if (books.elem[i].id>books.elem[j].id) {
|
||||
Book temp=books.elem[i];books.elem[i]=books.elem[j];books.elem[j]=temp;}
|
||||
}
|
||||
}
|
||||
cout << "*****************************" <<endl;
|
||||
cout << "Sort success"<<endl;
|
||||
}
|
||||
#ifndef DATA_H_INCLUDED
|
||||
#define DATA_H_INCLUDED
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sqlist.h"
|
||||
|
||||
|
||||
struct Book {
|
||||
int id; // 编号
|
||||
string title; // 标题
|
||||
int number; // 数量
|
||||
};
|
||||
|
||||
SqList <Book> books;
|
||||
|
||||
// 函数声明
|
||||
bool bookempty(); // 书籍库判空
|
||||
void input(Book& b); // 输入一本书的信息
|
||||
void print(const Book& b);// 打印一本书的信息
|
||||
int find(int id); // 根据 id 查找图书 || 若找到,返回元素的位序,找不到时返回 0
|
||||
|
||||
void DoAddBook(); // 添加图书
|
||||
void DoFindBook(); // 查找图书
|
||||
void DoDeleteBook(); // 删除图书
|
||||
void DoPrintBook(); // 打印所有图书
|
||||
void DoRepaidBook(); // 归还图书
|
||||
void DoBoorowBook(); // 借用图书
|
||||
void DoReviseBook(); // 修改图书
|
||||
void DoSortBook(); // 排序图书
|
||||
|
||||
|
||||
// 输入一本书的信息
|
||||
void input(Book& b)
|
||||
{
|
||||
cout << "ID : ";
|
||||
cin >> b.id;
|
||||
cin.ignore(1024, '\n'); // skip rest chars of the line
|
||||
cout << "TITLE : ";
|
||||
getline(cin, b.title);
|
||||
cout << "Number : ";
|
||||
while (1){
|
||||
cin >> b.number;
|
||||
if (b.number>0) break;
|
||||
cout << "Number ERROR" << endl;
|
||||
cout << "Input again" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// 打印一本书的信息
|
||||
void print(const Book& b)
|
||||
{
|
||||
cout << "Book " << endl << endl
|
||||
<<"**************** id: " << b.id << " ****************" << endl
|
||||
<< "**** title: 《 " << b.title << " 》****" << endl
|
||||
<< "************** Number: " << b.number << " **************" << endl << endl;
|
||||
}
|
||||
|
||||
// 根据 id 查找图书
|
||||
// 若找到,返回元素的位序,找不到时返回 0
|
||||
int find(int id)
|
||||
{
|
||||
|
||||
for (int i = 1; i <= books.length; i++)
|
||||
{
|
||||
if (id == books.elem[i].id){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return 0; // not found
|
||||
}
|
||||
|
||||
// 书籍库判空
|
||||
bool bookempty()
|
||||
{
|
||||
int a=0;
|
||||
for (int i=1;i<=books.length;i++)
|
||||
{
|
||||
if (find(i)==0) a++;
|
||||
}
|
||||
if (a==books.length) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
// 添加图书
|
||||
void DoAddBook()
|
||||
{
|
||||
cout << endl << "Add Book"<< endl<<endl;
|
||||
Book book;
|
||||
input(book); //输入图书
|
||||
books.elem[books.length + 1] = book;
|
||||
books.length++;
|
||||
print(book);
|
||||
cout << "*******Added********" << endl;
|
||||
}
|
||||
|
||||
// 查找图书
|
||||
void DoFindBook()
|
||||
{
|
||||
cout << endl << "Find Book" << endl <<endl;
|
||||
if (bookempty()) cout << "Book data empty"<< endl;
|
||||
int id;
|
||||
cout << "Enter book ID: ";
|
||||
cin >> id;
|
||||
|
||||
Book book;
|
||||
if (find(id) == 0)
|
||||
cout << "Not found" << endl;
|
||||
else
|
||||
{
|
||||
book = books.elem[find(id)];
|
||||
cout << "Found" << endl;
|
||||
cout << "************" << endl;
|
||||
print(book);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除图书
|
||||
void DoDeleteBook()
|
||||
{
|
||||
cout << endl << "Delete Book" << endl << endl;
|
||||
int id;
|
||||
cout << "Which book you wanna delelet?"<<endl;
|
||||
cout << "Enter book ID: ";
|
||||
cin >> id;
|
||||
Book e;
|
||||
if (find(id) == 0)
|
||||
cout << "Not found" << endl;
|
||||
else
|
||||
{
|
||||
e = books.elem[find(id)];
|
||||
print(e);
|
||||
for (int i = find(id); i < books.length; i++)
|
||||
{
|
||||
books.elem[i] = books.elem[i + 1];
|
||||
}
|
||||
--books.length;
|
||||
cout << "************************" << endl;
|
||||
cout << "Deleted" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// 打印所有图书
|
||||
void DoPrintBook()
|
||||
{
|
||||
cout << endl << "Print All Books" << endl <<endl;
|
||||
int flag = 0;
|
||||
for (int i = 0; i < books.length; i++)
|
||||
{
|
||||
Book e;
|
||||
e = books.elem[i + 1];
|
||||
print(e);
|
||||
flag++;
|
||||
}
|
||||
cout << "Total: ";
|
||||
cout << flag;
|
||||
cout << " books" << endl;
|
||||
}
|
||||
|
||||
// 归还图书
|
||||
void DoRepaidBook()
|
||||
{
|
||||
cout << endl << "Repaid Book" << endl<<endl;
|
||||
int id;
|
||||
cout << "Which book you wanna repaid ? " << endl;
|
||||
cout << "Enter book ID :" << endl;
|
||||
cin >> id;
|
||||
cout << endl;
|
||||
if (find(id)){
|
||||
Book e;
|
||||
e = books.elem[find(id)];
|
||||
++books.elem[find(id)].number;
|
||||
}else{
|
||||
DoAddBook();
|
||||
}
|
||||
}
|
||||
|
||||
// 借用图书
|
||||
void DoBoorowBook()
|
||||
{
|
||||
cout << endl << "Boorow Book" << endl <<endl;
|
||||
int id;
|
||||
if (bookempty()) cout << "Book data empty"<< endl;
|
||||
cout << "Which book you wanna boorow ? " << endl;
|
||||
cout << "Enter book ID :" << endl;
|
||||
cin >> id;
|
||||
cout << endl;
|
||||
if (find(id)){
|
||||
if (books.elem[find(id)].number>0) {
|
||||
Book e;
|
||||
e = books.elem[find(id)];
|
||||
cout<< "*********"<< endl << "OK" << endl << "*********"<<endl;
|
||||
--books.elem[find(id)].number;
|
||||
}else cout << "***************************"<< endl
|
||||
<< "Book empty" << endl << "***************************" << endl;
|
||||
}else cout<< "NOT FOUND THIS BOOK"<<endl;
|
||||
}
|
||||
|
||||
// 修改图书
|
||||
void DoReviseBook()
|
||||
{
|
||||
cout <<endl<< "Revise Book" <<endl <<endl;
|
||||
int id;
|
||||
printf( "Which book you wanna revise ?\n" );
|
||||
cin >> id;
|
||||
|
||||
if ( find(id)!=0 ) {
|
||||
printf ( "Original book number : %d\n", books.elem[id].number );
|
||||
printf ( "Revised number :" );
|
||||
int xiugai;
|
||||
scanf ( "%d", &xiugai );
|
||||
books.elem[id].number+=xiugai;
|
||||
cout << "**********************" << endl;
|
||||
printf ( "Revise success \n" );
|
||||
}
|
||||
else printf ( "No such book\n");
|
||||
}
|
||||
|
||||
// 排序图书
|
||||
void DoSortBook()
|
||||
{
|
||||
cout << endl << "Sort Books" << endl << endl;
|
||||
int a=0;
|
||||
if (bookempty()) cout << "Book data empty"<< endl;
|
||||
else {
|
||||
for (int i=1;i<books.length;i++)
|
||||
for (int j=books.length;j>0;j--)
|
||||
{
|
||||
if (books.elem[i].id>books.elem[j].id) {
|
||||
Book temp=books.elem[i];books.elem[i]=books.elem[j];books.elem[j]=temp;}
|
||||
}
|
||||
}
|
||||
cout << "*****************************" <<endl;
|
||||
cout << "Sort success"<<endl;
|
||||
}
|
||||
#endif // DATA_H_INCLUDED
|
@ -1,126 +1,126 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "data.h"
|
||||
#include "sqlist.h"
|
||||
|
||||
enum {
|
||||
CMD_QUIT, // 退出程序
|
||||
CMD_QUERY, // 查书(数量)
|
||||
CMD_BOOROW, // 借用书籍
|
||||
CMD_REPAID, // 归还书籍
|
||||
CMD_PRINT, // 打印书籍
|
||||
CMD_INSERT, // 添加书籍
|
||||
CMD_DELETE, // 删除书籍
|
||||
CMD_UPDATE, // 修改书籍
|
||||
CMD_SORT, // 排序书籍
|
||||
};
|
||||
|
||||
|
||||
// 函数声明
|
||||
void init(void); // 程序启动
|
||||
void quit(void); // 程序退出
|
||||
void display_menu(void); // 显示命令菜单
|
||||
|
||||
int make_choice(void); // 选择命令
|
||||
int confirm(const char* msg); // 确认
|
||||
|
||||
|
||||
|
||||
// 主函数
|
||||
int main(void)
|
||||
{
|
||||
init(); // 程序启动
|
||||
|
||||
InitList(books);
|
||||
|
||||
for(;;) {
|
||||
display_menu(); //
|
||||
int c = make_choice();
|
||||
switch(c) {
|
||||
case CMD_REPAID:// 还书
|
||||
{DoRepaidBook();
|
||||
break;}
|
||||
case CMD_BOOROW:// 借书
|
||||
{DoBoorowBook();
|
||||
break;}
|
||||
case CMD_PRINT:// 打印所有书籍
|
||||
{DoPrintBook();
|
||||
break;}
|
||||
case CMD_QUERY:// 查找书籍
|
||||
{DoFindBook();
|
||||
break;}
|
||||
case CMD_INSERT:// 添加书籍
|
||||
{DoAddBook();
|
||||
break;}
|
||||
case CMD_DELETE:// 删除书籍
|
||||
{DoDeleteBook();
|
||||
break;}
|
||||
case CMD_UPDATE:// 修改书籍
|
||||
{DoReviseBook();
|
||||
break;}
|
||||
case CMD_SORT: // 排序书籍
|
||||
{DoSortBook();
|
||||
break;}
|
||||
case CMD_QUIT:// 退出程序
|
||||
{if (confirm("确定要退出吗?")) quit(); // 仅在确认后退出
|
||||
break;}
|
||||
default:
|
||||
puts("命令错误,请重新选择");
|
||||
break;}
|
||||
}
|
||||
quit(); // 程序退出
|
||||
|
||||
DestroyList(books);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void init(void)
|
||||
{
|
||||
puts("*******图书管理系统启动*******");
|
||||
}
|
||||
void quit(void)
|
||||
{
|
||||
puts("系统退出");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void display_menu(void)
|
||||
{
|
||||
cout << "————————————————————————————————————————————————————————————————"<<endl;
|
||||
printf("| %d 查书 | %d 借书 | %d 还书 | %d 打印 | %d 添加 |\n| %d 删除 | %d 修改 | %d 排序 | %d 退出 |\n",
|
||||
CMD_QUERY,CMD_BOOROW,CMD_REPAID,CMD_PRINT,CMD_INSERT,CMD_DELETE,CMD_UPDATE,CMD_SORT,CMD_QUIT);
|
||||
cout << "————————————————————————————————————————————————————————————————"<<endl;
|
||||
}
|
||||
int make_choice(void)
|
||||
{
|
||||
int c; // 用户输入
|
||||
int n = 0; // 正确读入的数据项个数
|
||||
while (n == 0) {
|
||||
printf("请选择:");
|
||||
n = scanf("%d", &c); // 尝试读入整数 c
|
||||
scanf("%*[^\n]"); // 跳过一行中剩余的字符
|
||||
}
|
||||
return c;
|
||||
}
|
||||
int confirm(const char* msg)
|
||||
{
|
||||
char c = 'n'; // 默认选择是 no
|
||||
printf("%s(Y/N): ", msg); // 提示输入 yes/no 进行确认s
|
||||
scanf(" %c%*[^\n]", &c); // 读取第一个字符,忽略剩余字符
|
||||
return c == 'y' || c == 'Y'; // 返回确认结果
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
|
||||
#include "data.h"
|
||||
#include "sqlist.h"
|
||||
|
||||
enum {
|
||||
CMD_QUIT, // 退出程序
|
||||
CMD_QUERY, // 查书(数量)
|
||||
CMD_BOOROW, // 借用书籍
|
||||
CMD_REPAID, // 归还书籍
|
||||
CMD_PRINT, // 打印书籍
|
||||
CMD_INSERT, // 添加书籍
|
||||
CMD_DELETE, // 删除书籍
|
||||
CMD_UPDATE, // 修改书籍
|
||||
CMD_SORT, // 排序书籍
|
||||
};
|
||||
|
||||
|
||||
// 函数声明
|
||||
void init(void); // 程序启动
|
||||
void quit(void); // 程序退出
|
||||
void display_menu(void); // 显示命令菜单
|
||||
|
||||
int make_choice(void); // 选择命令
|
||||
int confirm(const char* msg); // 确认
|
||||
|
||||
|
||||
|
||||
// 主函数
|
||||
int main(void)
|
||||
{
|
||||
init(); // 程序启动
|
||||
|
||||
InitList(books);
|
||||
|
||||
for(;;) {
|
||||
display_menu(); //
|
||||
int c = make_choice();
|
||||
switch(c) {
|
||||
case CMD_REPAID:// 还书
|
||||
{DoRepaidBook();
|
||||
break;}
|
||||
case CMD_BOOROW:// 借书
|
||||
{DoBoorowBook();
|
||||
break;}
|
||||
case CMD_PRINT:// 打印所有书籍
|
||||
{DoPrintBook();
|
||||
break;}
|
||||
case CMD_QUERY:// 查找书籍
|
||||
{DoFindBook();
|
||||
break;}
|
||||
case CMD_INSERT:// 添加书籍
|
||||
{DoAddBook();
|
||||
break;}
|
||||
case CMD_DELETE:// 删除书籍
|
||||
{DoDeleteBook();
|
||||
break;}
|
||||
case CMD_UPDATE:// 修改书籍
|
||||
{DoReviseBook();
|
||||
break;}
|
||||
case CMD_SORT: // 排序书籍
|
||||
{DoSortBook();
|
||||
break;}
|
||||
case CMD_QUIT:// 退出程序
|
||||
{if (confirm("确定要退出吗?")) quit(); // 仅在确认后退出
|
||||
break;}
|
||||
default:
|
||||
puts("命令错误,请重新选择");
|
||||
break;}
|
||||
}
|
||||
quit(); // 程序退出
|
||||
|
||||
DestroyList(books);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void init(void)
|
||||
{
|
||||
puts("*******图书管理系统启动*******");
|
||||
}
|
||||
void quit(void)
|
||||
{
|
||||
puts("系统退出");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void display_menu(void)
|
||||
{
|
||||
cout << "————————————————————————————————————————————————————————————————"<<endl;
|
||||
printf("| %d 查书 | %d 借书 | %d 还书 | %d 打印 | %d 添加 |\n| %d 删除 | %d 修改 | %d 排序 | %d 退出 |\n",
|
||||
CMD_QUERY,CMD_BOOROW,CMD_REPAID,CMD_PRINT,CMD_INSERT,CMD_DELETE,CMD_UPDATE,CMD_SORT,CMD_QUIT);
|
||||
cout << "————————————————————————————————————————————————————————————————"<<endl;
|
||||
}
|
||||
int make_choice(void)
|
||||
{
|
||||
int c; // 用户输入
|
||||
int n = 0; // 正确读入的数据项个数
|
||||
while (n == 0) {
|
||||
printf("请选择:");
|
||||
n = scanf("%d", &c); // 尝试读入整数 c
|
||||
scanf("%*[^\n]"); // 跳过一行中剩余的字符
|
||||
}
|
||||
return c;
|
||||
}
|
||||
int confirm(const char* msg)
|
||||
{
|
||||
char c = 'n'; // 默认选择是 no
|
||||
printf("%s(Y/N): ", msg); // 提示输入 yes/no 进行确认s
|
||||
scanf(" %c%*[^\n]", &c); // 读取第一个字符,忽略剩余字符
|
||||
return c == 'y' || c == 'Y'; // 返回确认结果
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
*******图书管理系统启动*******
|
||||
————————————————————————————————————————————————————————————————
|
||||
| 1 查书 | 2 借书 | 3 还书 | 4 打印 | 5 添加 |
|
||||
| 6 删除 | 7 修改 | 8 排序 | 0 退出 |
|
||||
————————————————————————————————————————————————————————————————
|
||||
请选择:
|
Loading…
Reference in new issue