| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 494 人关注过本帖
标题:链表 改错 第一次出现这样的错误提示。
只看楼主 加入收藏
教皇
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2011-10-6
结帖率:95.65%
收藏
已结贴  问题点数:4 回复次数:6 
链表 改错 第一次出现这样的错误提示。
程序运行时显示:The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one
#include<iostream.h>
#include<string.h>
struct student
{
 char name[4];
 char address[10];
 float tel;
 student *next;

};
void main()
{
 student *create(void);
 void print(student *head);
 void del(student *head);

 student *head;
 head=create();
 print(head);
 del(head);
}

 student *create(void)
 {
  char name[4];
  student *head,*p1,*p2;
  head=NULL;
  
  cout<<"input the name:";
  cin>>name;
  while(strcmp(name,"end")!=0)
  {
   p1=new student;
   strcpy(p1->name,name);
   cout<<"input other information:";
   cin>>p1->address>>p1->tel;
   if(head==NULL)
    head=p2=p1;
   else
   {
    p2->next=p1;
    p2=p1;
   }

   cout<<"input the name:";
   cin>>name;
 }
 if(head!=NULL)
  p2->next=NULL;
 return (head);
}

 void print(student *head)
 {
  student *p;
  if(head==NULL)
   cout<<"it is not exist";
  p=head;
  while(p!=NULL)
  {
   cout<<p->name<<" "<<p->address<<" "<<p->tel<<endl;
   p=p->next;
  }
 
 
 }

 void del(student *head)
 {
  student *p;
  while(head!=NULL)
  {
   p=head;
   head=head->next;
   delete p;
  
  
  }
 
 
 }

搜索更多相关主题的帖子: head void address include create 
2012-04-06 21:39
C_596322153
Rank: 6Rank: 6
来 自:徽州
等 级:侠之大者
帖 子:182
专家分:466
注 册:2012-1-10
收藏
得分:1 
我在VC 6 上编译运行 木有问题
2012-04-07 08:00
教皇
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2011-10-6
收藏
得分:0 
回复 楼主 教皇
我运行就是有问题啊,弹出一个框不知道 为什么
2012-04-07 11:17
moonnight
Rank: 5Rank: 5
等 级:职业侠客
帖 子:158
专家分:380
注 册:2012-3-17
收藏
得分:1 
vc2010把iostream.h改成iostream,加上命名空间std;运行木有问题
2012-04-07 11:30
hellovfp
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:禁止访问
威 望:30
帖 子:2976
专家分:7697
注 册:2009-7-21
收藏
得分:1 
编译运行了一下,偶这里也运行正常啊。
不过,为什么这年头,还有人在用#include<iostream.h>这个头文件呢?

我们都在路上。。。。。
2012-04-07 11:37
教皇
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2011-10-6
收藏
得分:0 
回复 5楼 hellovfp
我学的教材就是这样啊。
2012-04-07 20:28
教皇
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2011-10-6
收藏
得分:0 
回复 5楼 hellovfp
我就是运行出问题不知道是为什么啊?
2012-04-07 20:30
快速回复:链表 改错 第一次出现这样的错误提示。
数据加载中...
 
   



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

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