严重性 代码 说明 项目 文件 行 错误(活动) 不能将 "struct Student" 类型的值分配到 "struct Student" 类型的实体 ch

qq_22674273 2016-03-23 07:06:19
#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");
}
...全文
20998 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2016-03-24
  • 打赏
  • 举报
回复
Visual C++ 2010 Express简体中文版http://pan.baidu.com/s/1bnwRVLt
wang0635 2016-03-23
  • 打赏
  • 举报
回复
编译器太老了吧
cutmelon 2016-03-23
  • 打赏
  • 举报
回复
严格来说没有写赋值操作符就不要直接赋值吧,用memcpy好些
cocoabird 2016-03-23
  • 打赏
  • 举报
回复

没什么问题啊

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧