结构体的错不会改
加颜色的地方有错,显示的是表达式必须是可修改的左值,这句话是什么意思啊?怎么改啊?#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include"dazuoye.h"
void modify1(struct stuMessage *addr)
{
char newidnum[8];
struct stuMessage *temp,*firstaddr;
printf("请输入您想修改学生的学号:");
scanf("%s",&newidnum);
gets(newidnum);
do
{
if(strcmp(firstaddr->idnum,newidnum)!=0)
firstaddr = firstaddr->nextaddr;
else
modify2(addr);
}while(firstaddr->nextaddr == NULL);
help();
}
void modify2(struct stuMessage *addr)
{
char ch,ch1,ch2,temp[20];
float newgrade;
int i;
//struct stuMessage *head;
//head=addr;
printf("请选择您想修改的信息:\n");
printf("a.姓名;b.学号;c.班级;d.成绩\n");
scanf("%c",&ch);
ch = getchar();
switch(ch)
{
case 'a':
printf("请输入新名字: ");
scanf("%s",temp);
addr->name = temp;
break;
case 'b':
printf("请输入新学号: ");
scanf("%s",temp);
addr->idnum = temp;
break;
case 'c':
printf("请输入新班级号: ");
scanf("%s",temp);
addr->idnum = temp;
break;
case 'd':
do{
printf("您想修改第几科的成绩? ");
scanf("%d",&i);
printf("\n请输入新成绩: ");
scanf("%f",&newgrade);
addr->grade[i] = newgrade;
printf("\n您想修改学生另外的成绩吗?(y or n) ");
scanf("%c",&ch);
ch = getchar();
}while(ch != 'y');
break;
}
printf("\n您是否想继续修改?(y or n) ");
scanf("%c",ch);
ch = getchar();
if(ch = 'y')
modify1(addr);
else
{
printf("\n您是否想进行别的操作?(y or n) ");
scanf("%c",&ch2);
ch2 = getchar();
if(ch2 == 'y')
menu();
else
exit(1);
}
}