Cx330_AverSumofEveryStudent

Cx330_AverSumofEveryStudent
Cx330 2 years ago
parent 488deb5721
commit e49ae6eb79

@ -0,0 +1,118 @@
<?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="2628" height="3348">
<rect x="0" y="0" width="2628" height="3348" fill="#FFFFFF"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="612,360 612,447"/>
<polygon fill="#404040" stroke="none" points="612,468 632,433 591,433"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="612,1224 612,3039"/>
<polygon fill="#404040" stroke="none" points="612,3060 632,3025 591,3025"/>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 252,144 A 108 108, 0, 0 0, 252 360 L 972,360 A 108 108, 0, 0 0, 972 144 Z"/>
<text x="612" y="165" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="612" dy="72" unicode-bidi="embed">AverSumofEveryStudent</tspan>
<tspan x="612" dy="72" unicode-bidi="embed">(Integer n, Integer m)</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="5" stroke-dasharray="none" d="M 468,3060 A 72 72, 0, 0 0, 468 3204 L 756,3204 A 72 72, 0, 0 0, 756 3060 Z"/>
<text x="612" y="3081" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="612" dy="72" unicode-bidi="embed">End</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="612,648 612,735"/>
<polygon fill="#404040" stroke="none" points="612,756 632,721 591,721"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="612,936 612,1059"/>
<polygon fill="#404040" stroke="none" points="612,1080 632,1045 591,1045"/>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" d="M 396,468 L 396,648 L 828,648 L 828,468 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" points="396,504 828,504"/>
<polyline fill="none" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" points="432,468 432,648"/>
<text x="630" y="525" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="630" dy="72" unicode-bidi="embed">Integer i</tspan>
</text>
</g>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" d="M 396,756 L 396,936 L 828,936 L 828,756 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" points="396,792 828,792"/>
<polyline fill="none" stroke="#A0A070" stroke-width="5" stroke-dasharray="none" points="432,756 432,936"/>
<text x="630" y="813" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="630" dy="72" unicode-bidi="embed">Integer j</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="900,1152 1404,1152 1404,1275"/>
<polygon fill="#404040" stroke="none" points="1404,1296 1424,1261 1383,1261"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1404,2808 1404,2916 684,2916 684,1244"/>
<polygon fill="#404040" stroke="none" points="684,1224 663,1258 704,1258"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1404,1440 1404,1563"/>
<polygon fill="#404040" stroke="none" points="1404,1584 1424,1549 1383,1549"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1404,1728 1404,2247"/>
<polygon fill="#404040" stroke="none" points="1404,2268 1424,2233 1383,2233"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1404,2412 1404,2499"/>
<polygon fill="#404040" stroke="none" points="1404,2520 1424,2485 1383,2485"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 1152,1296 L 1152,1440 L 1656,1440 L 1656,1296 Z"/>
<text x="1404" y="1317" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1404" dy="72" unicode-bidi="embed">stu[i].sum = 0</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="1692,1656 2052,1656 2052,1779"/>
<polygon fill="#404040" stroke="none" points="2052,1800 2072,1765 2031,1765"/>
<polyline fill="none" stroke="#404040" stroke-width="9" stroke-dasharray="none" points="2052,2016 2052,2124 1476,2124 1476,1748"/>
<polygon fill="#404040" stroke="none" points="1476,1728 1455,1762 1496,1762"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 1620,1800 L 1620,2016 L 2484,2016 L 2484,1800 Z"/>
<text x="2052" y="1821" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2052" dy="72" unicode-bidi="embed">stu[i].sum = stu[i].sum+stu</tspan>
<tspan x="2052" dy="72" unicode-bidi="embed">[i].score[j]</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="5" stroke-dasharray="none" d="M 1188,1584 L 1116,1656 L 1188,1728 L 1620,1728 L 1692,1656 L 1620,1584 Z"/>
<text x="1404" y="1605" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1404" dy="72" unicode-bidi="embed">j = 0 to m-1</tspan>
</text>
</g>
<text x="1800" y="1533" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1800" dy="72" unicode-bidi="embed">Next</tspan>
</text>
<text x="1278" y="1749" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1278" dy="72" unicode-bidi="embed">Done</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 1008,2268 L 1008,2412 L 1800,2412 L 1800,2268 Z"/>
<text x="1404" y="2289" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1404" dy="72" unicode-bidi="embed">stu[i].aver = stu[i].sum/m</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="5" stroke-dasharray="none" d="M 972,2520 L 828,2808 L 1836,2808 L 1980,2520 Z"/>
<text x="1404" y="2541" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1404" dy="72" unicode-bidi="embed">Output &quot;student %d: sum =</tspan>
<tspan x="1404" dy="72" unicode-bidi="embed"> %.0f,aver = %.0f\n&quot;, i + 1,</tspan>
<tspan x="1404" dy="72" unicode-bidi="embed"> stu[i].sum, stu[i].aver</tspan>
</text>
</g>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="5" stroke-dasharray="none" d="M 396,1080 L 324,1152 L 396,1224 L 828,1224 L 900,1152 L 828,1080 Z"/>
<text x="612" y="1101" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="612" dy="72" unicode-bidi="embed">i = 0 to n-1</tspan>
</text>
</g>
<text x="1008" y="1029" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1008" dy="72" unicode-bidi="embed">Next</tspan>
</text>
<text x="486" y="1245" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="486" dy="72" unicode-bidi="embed">Done</tspan>
</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.7 KiB

@ -420,6 +420,13 @@ Step 2利用循环输入学生的学号成绩和各科成绩
#### AverSumofEveryStudent
Step 1:利用for循环给 sum 赋初值为 0
Step 2:利用第二重循环重新计算每个学生的总分
Step 3:计算每个学生的平均分
Step 4:将结果按照舒徐,总分和平均分的顺序进行输出
![计算每个学生各门课程的总分和平均分](AverSumofEveryStudent.svg)
#### AverSumofEveryCourse
#### SortbyScore

Loading…
Cancel
Save