#include
#include
#include
typedef struct ElemType
{
char number[20];
char name[20];
char academy[10];
int Sd;
int math;
int English;
int total;
}ElemType;
typedef struct SqList
{
ElemType elem;
int length;
}SqList;
void input(SqList &p,int n)//输入函数
{
int i;
p.elem=(ElemType)malloc(sizeof(ElemType));
for(i=0;i<n;i++)
{
printf("请输入姓名:");scanf("%s",p.elem[i].name);
printf("请输入学院:");scanf("%s",p.elem[i].academy);
printf("请输入学号:");scanf("%s",p.elem[i].number);
printf("请输入数据结构成绩:");scanf("%d",&p.elem[i].Sd);
printf("请输入高数成绩:");scanf("%d",&p.elem[i].math);
printf("请输入英语成绩:");scanf("%d",&p.elem[i].English);
p.elem[i].total=p.elem[i].math+p.elem[i].English+p.elem[i].Sd;
printf("该生的总分为:%d\n",p.elem[i].total);
}
p.length=n;
}
编码问题
http://bbs.csdn.net/topics/392149079
汉子是占两个字节,你不能给一个字节赋值的