标题:[求助]如何解决Debug assertion failad
取消只看楼主
lzf0112
Rank: 1
等 级:新手上路
帖 子:244
专家分:0
注 册:2006-4-9
 问题点数:0 回复次数:1 
[求助]如何解决Debug assertion failad
#include <iostream.h>
#include <string.h>
class data
{
private:
int day,month,year;
public:
data();
int getyear()
{
return year;
}
int getmonth()
{
return month;
}
int getday()
{
return day;
}
void showdata();
void setdata(int y,int m,int d);
};
data::data()
{
year=month=day=0;
}
void data::showdata()
{
cout<<year<<"年"<<month<<"月"<<day<<"日"<<endl;
}
void data::setdata(int y,int m,int d)
{
year=y;month=m;day=d;
}
class employee
{
private:
int num;
char *name;
data birth;
public:
employee();
~employee();
void print();
void setemp(char *na,int n,int y,int m,int d);
int isbirth(data a,employee b);
};
employee::employee():birth()
{
name=new char[10];
strcpy(name," ");
num=0;
}
employee::~employee()
{
delete [] name;
}
void employee::setemp(char *na,int n,int y,int m,int d)
{
delete [] name;
name=new char[strlen(na)+1];
strcpy(name,na);
num=n;
birth.setdata(y,m,d);
}
void employee::print()
{
cout<<"雇员"<<name<<"编号为"<<num<<",";
cout<<"出生日期为:";
birth.showdata();
}
int employee::isbirth(data a,employee b)
{
if(a.getyear()==b.birth.getyear()&&a.getmonth()==b.birth.getmonth()&&a.getday()==b.birth.getday())
return 1;
else return 0;
}
void main()
{
char b[10];
int n,y,m,d;
data da;
employee a;
cout<<"请输入现在的日期为:";
cin>>y>>m>>d;
da.setdata(y,m,d);
cout<<"今天的日期为:";
da.showdata();
cout<<"请输入雇员的姓名、编号以及生日:";
cin>>b;
cin>>n>>y>>m>>d;
a.setemp(b,n,y,m,d);
a.print();
if(a.isbirth(da,a)==1)
cout<<"今天是他的生日";
else cout<<"今天不是他的生日";
}
为什么每次运行都会跳出窗口提示Debug assertion failad?
求求各位大侠帮帮忙啊!!!!在此,先谢谢大家咯
搜索更多相关主题的帖子: assertion int Debug failad data 
2006-06-24 17:42
lzf0112
Rank: 1
等 级:新手上路
帖 子:244
专家分:0
注 册:2006-4-9
得分:0 

谢谢斑竹的赐教~~~

2006-06-25 09:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-74572-1-1.html




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

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