| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2626 人关注过本帖
标题:显示 error C2106: '=' : left operand must be l-value请教
只看楼主 加入收藏
crz03128
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2007-5-22
收藏
 问题点数:0 回复次数:2 
显示 error C2106: '=' : left operand must be l-value请教

#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编辑过]

搜索更多相关主题的帖子: operand error left name include 
2007-06-16 21:15
ONOSIN
Rank: 2
等 级:论坛游民
帖 子:18
专家分:20
注 册:2007-6-16
收藏
得分:0 
你好像没有定义j吧

txl[j].name=txl[j+1].name;
txl[j].tel=txl[j+1].name;
2007-06-16 21:32
crz03128
Rank: 1
等 级:新手上路
帖 子:83
专家分:0
注 册:2007-5-22
收藏
得分:0 
己经改了,还是会出现

老师领进门,成长靠自己+虚心
2007-06-17 16:13
快速回复:显示 error C2106: '=' : left operand must be l-value请教
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011929 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved