严重性 代码 说明 项目 文件 行 错误(活动) 不能将 "struct Student" 类型的值分配到 "struct Student" 类型的实体 ch
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct Student
{
int num;
char name[20];
float score;
}stu[5] = { {10101,"Zhang",78},{10103,"Wang",98.5},{10106,"Li",86},{10108,"Ling",73.5},{10110,"Sun",100} };
int main()
{
struct Student temp;
const int n = 5;
int i, j;
printf_s("The order is:\n");
for (i = 0; i < n - 1; i++)
{
for (j = i + 1; j < n; j++)
{
if (stu[j].score > stu[i].score)
{
temp = stu[i]; stu[i] = stu[j]; stu[j] = temp;
}
}
}
for (i = 0; i < n; i++)
{
printf_s("%6d %8s %6.2f\n", stu[i].num, stu[i].name, stu[i].score);
}
printf_s("\n");
}