老是提示"Access Violation",求教

m1043 2011-11-23 08:34:35
#include <iostream>
#include <cstring>

using namespace std;

typedef char DataType;
#define N 30

struct stu
{
char name[N];
char num[10];
char mail[N];
struct stu *next;
int seletion;
char date[N];
};

char popList(stu *H)
{
stu *p=H;
while(p->next){
cout<<"你的姓名是:";
cin>>p->next->name;
cout<<"你的手机号码是:";
cin>>p->next->num;
cout<<"你的邮件是:";
cin>>p->next->mail;
cout<<"继续录入请按0 否则请按1";
cin>>p->next->seletion;
if (p->next->seletion==0)
{
p=p->next;
popList(p);
}
if(p->seletion==1)
return 1;
}

}
...全文
227 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
gw_net 2011-11-23
  • 打赏
  • 举报
回复
debug into assembly code
m1043 2011-11-23
  • 打赏
  • 举报
回复
对,应该是使用了未分配的空间,但是数组那些我都有分配喔
~~~唉想全部黏贴出来的,但是看着头晕
Qyee16 2011-11-23
  • 打赏
  • 举报
回复
还有可能是使用了未分配的空间----------------这lz---够懒
y1509713911 2011-11-23
  • 打赏
  • 举报
回复
根据个人的经验,出现这个错误很有可能是某个变量访问越界了。lz可以单步跟踪试试。
m1043 2011-11-23
  • 打赏
  • 举报
回复
#include "zxk.h"
int main()
{
//定义管理单链表的头指针
stu *head;
InitList(head); //初始化单链表head
while(head->seletion!=0){
cout<<"*************************************"<<endl;
cout<<" 手机电话簿系统、请按相应数字进行操作"<<endl;
cout<<"1、存储电话"<<endl;
cout<<"2、查看已经录入的电话号码信息"<<endl;
cout<<"0、退出系统,拜拜"<<endl;
cout<<"*************************************"<<endl;
if(head->seletion==2){
cout<<"请输入你要的人的姓名:"<<endl;
cin>>head->date;}
switch(head->seletion){
case 1:cout<<popList(head);break;
case 2:Find(head,head->date);break;
}
head++;
head=new stu;
cout<<"请输入对应的数字键继续您的操作:"<<endl;
cin>>head->seletion;
cout<<"你的选择是第:"<<head->seletion<<"个"<<endl;

}

/*pushList(head);*/

}
觉得main函数好长,嘿嘿
机智的呆呆 2011-11-23
  • 打赏
  • 举报
回复
lz你好歹给个main函数啊~~或者说明一下在那中断

64,654

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

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