Compare commits

...

13 Commits

@ -25,7 +25,7 @@
| C14 从文件中读取学生信息 | 李雨佳 | 李雨佳 | 张宇 徐子贵 | 许子林 |
每个成员的工作量(百分比):
| 李雨佳 | 徐子贵 | 许子林 | 张宇 |
| ------ | ----- | ------ | --- |
|30 | 30 | 20 | 20 |
@ -423,43 +423,60 @@ Step 2利用循环输入学生的学号成绩和各科成绩
Step 1:利用for循环给 sum 赋初值为 0
Step 2:利用第二重循环重新计算每个学生的总分
Step 3:计算每个学生的平均分
Step 4:将结果按照舒徐,总分和平均分的顺序进行输出
Step 4:将结果按照顺序,总分和平均分的顺序进行输出
![计算每个学生各门课程的总分和平均分](AverSumofEveryStudent.svg)
#### AverSumofEveryCourse
step 1:利用for循环给 sum 赋初值为 0
Step 1:利用for循环给 sum 赋初值为 0
Step 2:利用第二重循环重新计算每门课程的总分
Step 3:计算每门课程的平均分
tep 4:将结果按照顺序,总分和平均分的顺序进行输出
Step 4:将结果按照顺序,总分和平均分的顺序进行输出
![计算每门课程的总分和平均分](AverSumofEveryCourse.svg)
#### SortbyScore
step 1:利用循环将i赋值给k
step 2:用循环从i+1到n-1比较,将较小的赋给k
step 3:如果k与i不相等每一课的成绩交换
step 4:总分,平均分,学号,姓名依次交换
Step 1:利用循环将i赋值给k
Step 2:用循环从i+1到n-1比较,将较小的赋给k
Step 3:如果k与i不相等每一课的成绩交换
Step 4:总分,平均分,学号,姓名依次交换
![按选择法将数组 sum 的元素值排序](SortbyScore.svg)
#### AsSortbyNum
step 1:利用循环将i赋值给k
step 2:用循环从i+1到n-1比较,将较小的学号赋给k
step 3:如果k与i不相等每一课的成绩交换
step 4:总分,平均分,学号,姓名依次交换
Step 1:利用循环将i赋值给k
Step 2:用循环从i+1到n-1比较,将较小的学号赋给k
Step 3:如果k与i不相等每一课的成绩交换
Step 4:总分,平均分,学号,姓名依次交换
![按选择法将数组 num 的元素从低到高排序](AsSortbyNum.svg)
#### SortbyName
Step 1:利用for循环将相邻的两个姓名作比较
Step 2:如果前一个字符串大于后一个利用for循环交换m门课程的成绩
Step 3:依次交换
![交换法实现字符串按字典顺序排序](SortbyName.svg)
#### SearchbyNum
Step 1:利用for循环给 i 赋值为 0
Step 2:利用 if 条件判断学号是否一致
Step 3:利用二次循环找出所有符合条件的学生
Step 4:利用if条件语句能否找到该学生
![按学号查找学生成绩并显示查找结果](SearchbyNum.svg)
#### SearchbyName
Step 1:利用for循环给 i 赋值为 0
Step 2:利用 if 条件和循环判断是否有此学生并显示结果
![按姓名查找学生成绩并显示查找结果](SearchbyName.svg)
#### StatisticAnalysis
Step 1:将数组 t 的全部元素初始化为0
@ -555,7 +572,7 @@ int main(void)
int n = 0,m = 0;
STU stu[STU_NUM];
printf("Input student number(n<%d):",STU_NUM);
scnaf("%d",&n);
scanf("%d",&n);
printf("Input course number(m<=%d):",COURSE_NUM);
scanf("%d",&m);
while(1)
@ -598,7 +615,7 @@ int main(void)
case 13:ReadfromFile(stu,&n,&m);
break;
case 0: printf("Are you sure you want to exit?(Y/N):");
printf("End of program!);
printf("End of program!");
exit(0);
default:printf("Input error!");
}
@ -611,353 +628,305 @@ int main(void)
```
int Menu(void)
{
int itemSelected;
printf("Management for Students' scores\n");
printf("1 Input record\n");
printf("2 Calculate total and average score of every course\n");
printf("3 Calculate total and average score of every student\n");
printf("4 Sort in descending order by score\n");
printf("5 Sort in ascending order by score\n");
printf("6 Sort in ascending order by number\n");
printf("7 Sort in dictionary order by name\n");
printf("8 Search by number\n");
printf("9 Search by name\n");
printf("10 Statistic analysis\n");
printf("11 List record\n");
printf("12 Write to a file\n");
printf("13 Read from a file\n");
printf("0 Exit\n");
printf("Please Input your choice:");
scanf("%d",&itemSelected); //读入用户输入
return itemSelected;
set itemSelected
printf "Management for Students' scores\n"
printf "1 Input record\n"
printf "2 Calculate total and average score of every course\n"
printf "3 Calculate total and average score of every student\n"
printf "4 Sort in descending order by score\n"
printf "5 Sort in ascending order by score\n"
printf "6 Sort in ascending order by number\n"
printf "7 Sort in dictionary order by name\n"
printf "8 Search by number\n"
printf "9 Search by name\n"
printf "10 Statistic analysis\n"
printf "11 List record\n"
printf "12 Write to a file\n"
printf "13 Read from a file\n"
printf "0 Exit\n"
printf "Please Input your choice:"
input itemSelected //读入用户输入
return itemSelected
}
```
// 函数功能:输入 n 个学生的 m 门课成绩
```
void ReadScore(STU stu[],int n,int m)
{
function ReadScore(STU stu[],int n,int m) do
int i,j;
printf("Input student's ID ,name and score:\n");
for(i=0,i<n;i++) //n
{
scanf("%ld%s",&stu[i].num,stu[i].name);
for(j=0;j<m;j++) //m
scanf("%f",&stu[i].score[j]);
}
}
printf "Input student's ID ,name and score:\n"
for from i=0 to n-1 do //输入n个同学
input stu[i].num,stu[i].name
for form j=0 to m-1 do //输入m门成绩
input stu[i].score[j]
end
end
end
```
//函数功能:计算每个学生各门课程的总分和平均分
```
void AverSumofEveryStudent(STU stu[],int n,int m)
{
function AverSumofEveryStudent(STU stu[],int n,int m) do
int i,j;
for(i=0;i<n;i++)
{
for form i=0 to n-1 do
stu[i].sum = 0; //初始化每个学生总分为0
for(j=0;j<m;j++)
{
for from j=0 to m-1 do
stu[i].sum = stu[i].sum + stu[i].score[j]; //累加分数
}
end
stu[i].aver = m>0 ? stu[i].sum /m : -1;
printf("student %d: sum = %.0f,aver = %.0f\n",i+1,stu[i].sum,stu[i].aver);
}
}
printf "student %d: sum = %.0f,aver = %.0f\n"
end
end
```
//函数功能:计算每门课程的总分和平均分
```
void AverSumofEveryCourse(STU stu[],int n,int m)
{
function AverSumofEveryCourse(STU stu[],int n,int m) do
int i,j;
float sum[COURSE_NUM],aver[COURSE_NUM];
for(j=0;j<m;j++)
{
for from j=0 to m-1 do
sum[j] = 0;
for(i=0;i<n;i++)
{
for from i=0 to n-1 do
sum[j]+= stu[i].score[j]; //计算n个同学每门课程的总分
}
end
aver[j] = sum[j]/i;
printf("course %d: sum = %.0f,aver = %.0f\n",j+1, sum[j], aver[j]);
}
}
printf "course %d: sum = %.0f,aver = %.0f\n"
end
end
```
//函数功能:按选择法将数组 sum 的元素值排序
```
voidSortbyScore(STU stu[],int n,int m,int(*compare)(float a,float b))
{
function SortbyScore(STU stu[],int n,int m,int(*compare)(float a,float b)) do
int i, j, k, t;
for (i=0; i<n-1; i++)
{
for from i=0 to n-2 do
k = i;
for (j=i+1; j<n; j++)
{
if ((*compare)(stu[j].sum, stu[k].sum)) k = j;
}
if (k != i)
{
for (t=0; t<m; t++) //m
{
for from i+1 to n-1 do
if (*compare)(stu[j].sum, stu[k].sum) set k = j;
end
if k != i
for from t=0 to m-1 do //交换m门课程的成绩
SwapFloat(&stu[k].score[t], &stu[i].score[t]);
}
end
SwapFloat(&stu[k].sum, &stu[i].sum); //交换总分
SwapFloat(&stu[k].aver, &stu[i].aver); //交换平均分
SwapLong(&stu[k].num, &stu[i].num); //交换学号
SwapChar(stu[k].name, stu[i].name); //交换姓名
}
}
}
end
end
end
```
//使数据按升序排序
```
int Ascending(float a,float b)
{
function Ascending(float a,float b) do
return a < b; //a<b
}
end
```
//使数据按降序排序
```
int Descending(float a,float b)
{
function Descending(float a,float b) do
return a > b; // 这样比较决定了按降序排序,如果 a>b则交换
}
end
```
//交换两个单精度浮点型数据
```
void SwapFloat(float *x,float *y)
{
function SwapFloat(float *x,float *y) do
float temp;
temp = *x;
*x = *y;
*y = temp;
}
end
```
//交换两个长整型数据
```
void SwapLong(long *x,long *y)
{
function SwapLong(long *x,long *y) do
long temp;
temp = *x;
*x = *y;
*y = temp;
}
end
```
//交换两个字符串
```
void SwapChar(char x[],chary[])
{
function SwapChar(char x[],char y[]) do
char temp[MAX_LEN];
strcpy(temp, x);
strcpy(x, y);
strcpy(y, temp);
}
end
```
//函数功能:按选择法将数组 num 的元素从低到高排序
```
void AsSortbyNum(STU stu[],int n,int m)
{
function AsSortbyNum(STU stu[],int n,int m) do
int i, j, k, t;
for (i=0; i<n-1; i++)
{
for from i=0 to n-2 do
int i, j, k, t;
k = i;
for (j=i+1; j<n; j++)
{
if (stu[j].num < stu[k].num) k = j;
}
if (k != i)
{
for (t=0; t<m; t++) //m
{
set k = i;
for from j=i+1 to n-1 do
if stu[j].num < stu[k].num set k = j;
end
if k != i do
for from t=0 to m-1 do //交换m门课程的成绩
SwapFloat(&stu[k].score[t], &stu[i].score[t]);
}
end
SwapFloat(&stu[k].sum, &stu[i].sum); //交换总分
SwapFloat(&stu[k].aver, &stu[i].aver); //交换平均分
SwapLong(&stu[k].num, &stu[i].num); //交换学号
SwapChar(stu[k].name, stu[i].name); //交换姓名
}
}
}
end
end
end
```
//函数功能:交换法实现字符串按字典顺序排序
```
void SortbyName(STU stu[],int n,int m)
{
function SortbyName(STU stu[],int n,int m) do
int i, j, t;
for (i=0; i<n-1; i++)
{
for (j = i+1; j<n; j++)
{
if (strcmp(stu[j].name, stu[i].name) < 0)
{
for (t=0; t<m; t++) //m
{
for from i=0 to n-2 do
for from j = i+1 to n-1 do
if strcmp(stu[j].name, stu[i].name) < 0 do
for from t=0 to m-1 do //交换m门课程的成绩
SwapFloat(&stu[i].score[t], &stu[j].score[t]);
}
end
SwapFloat(&stu[i].sum, &stu[j].sum); //交换总分
SwapFloat(&stu[i].aver, &stu[j].aver); //交换平均分
SwapLong(&stu[i].num, &stu[j].num); //交换学号
SwapChar(stu[i].name, stu[j].name); //交换姓名
}
}
}
}
end
end
end
end
```
//函数功能:按学号查找学生成绩并显示查找结果
```
void SearchbyNum(STU stu[],int n,int m)
{
function SearchbyNum(STU stu[],int n,int m) do
long number;
int i,j;
printf("Input the number you want to search:");
scanf("%ld",&number);
for(i=0;i<n;i++)
if(stu[i].num==number)
{
printf("\n");
for(j=0;j<m;j++)
printf("%d\t",stu[i].score[j]);
printf("\n");
printf"Input the number you want to search:"
input number
forfrom i=0 to n-1 do
if stu[i].num==number do
printf"\n"
for from j=0 to m-1 do
printf "%d\t"
printf "\n"
break;
}
if(i==n)
printf("\nNot found!\n");
}
end
if i==n
printf "\nNot found!\n"
end
```
//函数功能:按姓名查找学生成绩并显示查找结果
```
void SearchbyName(STU stu[],int n,int m)
{
function SearchbyName(STU stu[],int n,int m) do
char x[MAX_LEN];
int i,j;
printf("Input the name you want to search:");
scanf("%s", x);
for(i=0;i<n;i++)
{
if(strcmp(stu[i].name,x)==0)
{
printf("%ld\t%s\t",stu[i].num,stu[i].name);
for(j=0;j<m;j++)
{
printf("%.0f\t",stu[i].score[j]);
}
printf(".0f\t%.0f\n",stu[i].sum,stu[i].aver);
printf "Input the name you want to search:"
input x
for from i=0 to n-1 do
if strcmp(stu[i].name,x)==0 do
printf "%ld\t%s\t",stu[i].num,stu[i].name"
for from j=0 to m-1 do
printf "%.0f\t"
end
printf ".0f\t%.0f\n"
return;
}
}
printf("\nNot found!\n);
}
end
end
printf "\nNot found!\n"
end
```
//函数功能:统计各分数段的学生人数及所占的百分比
```
void StatisticAnalysis(STU stu[],int n,int m)
{
funtion StatisticAnalysis(STU stu[],int n,int m) do
int i,j,t[6];
for(j=0;j<m;j++)
{
printf("For course %d:\n",j+1);
for from j=0 do m-1 do
printf "For course %d:\n"
memset(t,0,sizeof(t)); //将数组 t 的全部元素初始化为0
for(i=0;i<n;i++)
{
if(stu[i].score[j]>=0&&stu[i].score[j]<60) t[0]++;
else if(stu[i].score[j]<70) t[1]++;
else if(stu[i].score[j]<80) t[2]++;
else if(stu[i].score[j]<90) t[3]++;
else if(stu[i].score[j]<100) t[4]++;
else if(stu[i].score[j]==100) t[5]++;
}
for(i=0;i<=5;i++)
{
if(i==0) printf("<60\t%d\t%.2f%%\n",t[i],(float)t[i]/n*100);
else if(i==5) printf("%d\t%d\t%.2f%%\n",(i+5)*10,t[i],(float)t[i]/n*100);
else printf("%d-%d\t%d\t%.2f%%\n",(i+5)*10,(i+5)*10+9,t[i],(float)t[i]/n*100);
}
}
}
for from i=0 to n-1 do
if stu[i].score[j]>=0&&stu[i].score[j]<60 set t[0]++
else if stu[i].score[j]<70 set t[1]++;
else if stu[i].score[j]<80 set t[2]++;
else if stu[i].score[j]<90 set t[3]++;
else if stu[i].score[j]<100 set t[4]++;
else if stu[i].score[j]==100 set t[5]++;
end
for from i=0 to 4 do
if i==0 printf "<60\t%d\t%.2f%%\n"
else if i==5 printf "%d\t%d\t%.2f%%\n"
else printf "%d-%d\t%d\t%.2f%%\n"
end
end
end
```
//函数功能:打印学生成绩
```
void PrintScore(STU stu[],int n,int m)
{
function PrintScore(STU stu[],int n,int m) do
int i,j;
for (i=0; i<n; i++)
{
printf("%ld\t%s\t", stu[i].num, stu[i].name);
for (j=0; j<m; j++)
{
printf("%.0f\t", stu[i].score[j]);
}
printf("%.0f\t%.0f\n", stu[i].sum, stu[i].aver);
}
}
for from i=0 to n-1 do
printf "%ld\t%s\t"
for from j=0 to m-1 do
printf "%.0f\t"
end
printf "%.0f\t%.0f\n"
end
end
```
//输出 n 个学生的学号、姓名及 m 门课程的成绩到文件 student.txt 中
```
void WritetoFile(STU stu[],int n,int m)
{
function WritetoFile(STU stu[],int n,int m) do
FILE *fp;
int i, j;
if((fp = fopen("student.txt","w")) == NULL)
{
printf("Failure to open score.txt!\n");
if fp = fopen("student.txt","w") == NULL do
printf "Failure to open score.txt!\n"
exit(0);
}
end
fprintf(fp, "%d\t%d\n", n, m); //将学生人数和课程门数写入文件
for (i=0; i<n; i++)
{
for from i=0 to n-1 do
fprintf(fp, "%10ld%10s", stu[i].num, stu[i].name);
for (j=0; j<m; j++)
{
for from j=0 to m-1 do
fprintf(fp, "%10.0f", stu[i].score[j]);
}
end
fprintf(fp, "%10.0f%10.0f\n", stu[i].sum, stu[i].aver);
}
end
fclose(fp);
}
end
```
//从文件中读取学生的学号、姓名及成绩等信息写入到结构体 stu 中
```
void ReadfromFile(STU stu[],int *n,int *m)
{
function ReadfromFile(STU stu[],int *n,int *m) do
FILE *fp;
int i, j;
if ((fp = fopen("student.txt","r")) == NULL)
{
printf("Failure to open score.txt!\n");
if fp = fopen("student.txt","r") == NULL do
printf "Failure to open score.txt!\n"
exit(0);
}
end
fscanf(fp, "%d\t%d", n, m); //从文件中读出学生人数,课程门数
for (i=0; i<*n; i++) //学生人数保存在n指向的储存单元
{
for from i=0 to *n-1 do //学生人数保存在n指向的储存单元
fscanf(fp, "%10ld", &stu[i].num);
fscanf(fp, "%10s", stu[i].name);
for (j=0; j<*m; j++) //课程门数保存在m指向的储存单元
{
for form j=0 to *m-1 do //课程门数保存在m指向的储存单元
fscanf(fp, "%10f", &stu[i].score[j]); //不能用%10.0f
}
end
fscanf(fp, "%10f%10f", &stu[i].sum, &stu[i].aver); //不能用%10.0f
}
end
fclose(fp);
}
```
[def]: AsScortNum.svg
end
```

@ -0,0 +1,189 @@
<?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="3472" height="4464">
<rect x="0" y="0" width="3472" height="4464" fill="#FFFFFF"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,248 372,323"/>
<polygon fill="#404040" stroke="none" points="372,341 389,310 354,310"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,1240 372,4198"/>
<polygon fill="#404040" stroke="none" points="372,4216 389,4185 354,4185"/>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="4" stroke-dasharray="none" d="M 217,124 A 62 62, 0, 0 0, 217 248 L 527,248 A 62 62, 0, 0 0, 527 124 Z"/>
<text x="372" y="142" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="372" dy="62" unicode-bidi="embed">SortbyName</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="4" stroke-dasharray="none" d="M 248,4216 A 62 62, 0, 0 0, 248 4340 L 496,4340 A 62 62, 0, 0 0, 496 4216 Z"/>
<text x="372" y="4234" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="372" dy="62" unicode-bidi="embed">End</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,496 372,571"/>
<polygon fill="#404040" stroke="none" points="372,589 389,558 354,558"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,744 372,819"/>
<polygon fill="#404040" stroke="none" points="372,837 389,806 354,806"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,992 372,1098"/>
<polygon fill="#404040" stroke="none" points="372,1116 389,1085 354,1085"/>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" d="M 186,341 L 186,496 L 558,496 L 558,341 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="186,372 558,372"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="217,341 217,496"/>
<text x="387" y="390" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="387" dy="62" unicode-bidi="embed">Integer i</tspan>
</text>
</g>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" d="M 186,589 L 186,744 L 558,744 L 558,589 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="186,620 558,620"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="217,589 217,744"/>
<text x="387" y="638" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="387" dy="62" unicode-bidi="embed">Integer j</tspan>
</text>
</g>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" d="M 186,837 L 186,992 L 558,992 L 558,837 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="186,868 558,868"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="217,837 217,992"/>
<text x="387" y="886" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="387" dy="62" unicode-bidi="embed">Integer t</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="620,1178 806,1178 806,1315"/>
<polygon fill="#404040" stroke="none" points="806,1333 823,1302 788,1302"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="806,1457 806,4092 434,4092 434,1257"/>
<polygon fill="#404040" stroke="none" points="434,1240 416,1270 451,1270"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="1054,1395 1705,1395 1705,1501"/>
<polygon fill="#404040" stroke="none" points="1705,1519 1722,1488 1687,1488"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="1705,3875 1705,3968 868,3968 868,1474"/>
<polygon fill="#404040" stroke="none" points="868,1457 850,1487 885,1487"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2139,1767 2356,1767 2356,2090"/>
<polygon fill="#404040" stroke="none" points="2356,2108 2373,2077 2338,2077"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,3720 2356,3844 1753,3844"/>
<polygon fill="#404040" stroke="none" points="1736,3844 1766,3861 1766,3826"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="1271,1767 1023,1767 1023,3844 1656,3844"/>
<polygon fill="#404040" stroke="none" points="1674,3844 1643,3826 1643,3861"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1705,1519 L 1240,1767 L 1705,2015 L 2170,1767 Z"/>
<text x="1705" y="1692" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1705" dy="62" unicode-bidi="embed">strcmp(stu[j].name, stu[i].</tspan>
<tspan x="1705" dy="62" unicode-bidi="embed">name) &lt; 0</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,2232 2356,2679"/>
<polygon fill="#404040" stroke="none" points="2356,2697 2373,2666 2338,2666"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,2883 2356,2958"/>
<polygon fill="#404040" stroke="none" points="2356,2976 2373,2945 2338,2945"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,3162 2356,3237"/>
<polygon fill="#404040" stroke="none" points="2356,3255 2373,3224 2338,3224"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,3441 2356,3516"/>
<polygon fill="#404040" stroke="none" points="2356,3534 2373,3503 2338,3503"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2604,2170 2945,2170 2945,2276"/>
<polygon fill="#404040" stroke="none" points="2945,2294 2962,2263 2927,2263"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2945,2480 2945,2573 2418,2573 2418,2249"/>
<polygon fill="#404040" stroke="none" points="2418,2232 2400,2262 2435,2262"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 2542,2294 L 2542,2480 L 3348,2480 L 3348,2294 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2573,2294 2573,2480"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="3317,2294 3317,2480"/>
<text x="2945" y="2312" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2945" dy="62" unicode-bidi="embed">SwapFloat(&amp;stu[i].score[t], &amp;</tspan>
<tspan x="2945" dy="62" unicode-bidi="embed">stu[j].score[t])</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="4" stroke-dasharray="none" d="M 2170,2108 L 2108,2170 L 2170,2232 L 2542,2232 L 2604,2170 L 2542,2108 Z"/>
<text x="2356" y="2126" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">t = 0 to m-1</tspan>
</text>
</g>
<text x="2697" y="2064" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2697" dy="62" unicode-bidi="embed">Next</tspan>
</text>
<text x="2247" y="2250" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2247" dy="62" unicode-bidi="embed">Done</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1922,2697 L 1922,2883 L 2790,2883 L 2790,2697 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1953,2697 1953,2883"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2759,2697 2759,2883"/>
<text x="2356" y="2715" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapFloat(&amp;stu[i].sum, &amp;stu[j].</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">sum)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1922,2976 L 1922,3162 L 2790,3162 L 2790,2976 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1953,2976 1953,3162"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2759,2976 2759,3162"/>
<text x="2356" y="2994" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapFloat(&amp;stu[i].aver, &amp;stu[j].</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">aver)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1922,3255 L 1922,3441 L 2790,3441 L 2790,3255 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1953,3255 1953,3441"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2759,3255 2759,3441"/>
<text x="2356" y="3273" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapLong(&amp;stu[i].num, &amp;stu[j].</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">num)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1953,3534 L 1953,3720 L 2759,3720 L 2759,3534 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1984,3534 1984,3720"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2728,3534 2728,3720"/>
<text x="2356" y="3552" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapChar(stu[i].name, stu</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">[j].name)</tspan>
</text>
</g>
</g>
<g>
</g>
<ellipse cx="1705" cy="3844" rx="31" ry="31" fill="#C04040" stroke="#602020" stroke-width="4"/>
<text x="2263" y="1661" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2263" dy="62" unicode-bidi="embed">True</tspan>
</text>
<text x="1131" y="1661" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1131" dy="62" unicode-bidi="embed">False</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="4" stroke-dasharray="none" d="M 620,1333 L 558,1395 L 620,1457 L 992,1457 L 1054,1395 L 992,1333 Z"/>
<text x="806" y="1351" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="806" dy="62" unicode-bidi="embed">j = i+1 to n-1</tspan>
</text>
</g>
<text x="1147" y="1289" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1147" dy="62" unicode-bidi="embed">Next</tspan>
</text>
<text x="697" y="1475" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="697" dy="62" unicode-bidi="embed">Done</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="4" stroke-dasharray="none" d="M 186,1116 L 124,1178 L 186,1240 L 558,1240 L 620,1178 L 558,1116 Z"/>
<text x="372" y="1134" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="372" dy="62" unicode-bidi="embed">i = 0 to n-2</tspan>
</text>
</g>
<text x="713" y="1072" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="713" dy="62" unicode-bidi="embed">Next</tspan>
</text>
<text x="263" y="1258" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="263" dy="62" unicode-bidi="embed">Done</tspan>
</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

Loading…
Cancel
Save