#include<stdio.h>
#include<string.h>
struct AdressBook
{ char name[20];
char tel[20];
}txl[5]={{"Li","39344752"},{"Wang","39344730"},{"Xie","39344784"},{"Zhang","39374776"}};
void main()
{
int i,j,t=0,flag=0,a[5];
char hisname[20];printf("please insert an new name and tel:");/*插入功能*/
scanf("%s %s",txl[4].name,txl[4].tel);
for(i=0;i<5;i++)
printf("%s %s\n",txl[i].name,txl[i].tel); printf("please input the name you want search:");/*查找功能*/
scanf("%s",hisname);
for(i=0;i<5;i++)
if(strcmp(hisname,txl[i].name)==0)
{flag=1;a[t]=i;t++;}
if(flag=1)
for(i=0;i<t;i++)
printf("%s\n",txl[a[i]].tel);
else
printf("the name you search did't in the AdressBook\n");
printf("input the name you wnat to del:"); /*前面两个功能都顺利实现,就是这个删除功能实现不了*/
scanf("%s",hisname);
for(i=0;i<6;i++)
if(strcmp(txl[i].name,hisname)==0)
{
txl[j].name=txl[j+1].name;
txl[j].tel=txl[j+1].name;
}
}
提示为:error C2106: '=' : left operand must be l-value
有人能解释下这是什么意思,为什么会导致这样的结果,及修改的方法吗??
[此贴子已经被作者于2007-6-17 16:12:48编辑过]
----------------解决方案--------------------------------------------------------
你好像没有定义j吧
txl[j].name=txl[j+1].name;
txl[j].tel=txl[j+1].name;
----------------解决方案--------------------------------------------------------
己经改了,还是会出现
----------------解决方案--------------------------------------------------------