c 问题,为什么不能运行程序?

[复制链接]
查看11 | 回复1 | 2011-3-6 12:05:50 | 显示全部楼层 |阅读模式
#includeiostream.h
#includemath.h
class complex{
private:
double real;
double image;
public:
complex (double r=0.0,double i=0.0)
{real=r; imag=i;}
double realcomplex() {return real;}
double imagcomplex() {return imag;}
double abscomplex()
{double t;
t = real*rear image*image;
return sqrt(t);}
}


void main()
{{ccomplex a (1.1,2.2) ;
cout“real of complex
a=“a.realcomplex()endl;
cout“image of complex
a=“a.imagelcomplex()endl;
cout“abs of complex
a=“a.abscomplex()endl;
complex b;
cout“real of complex
b=“b.realcomplex()endl;
cout“image of complex
b=“b.imagelcomplex()endl;
cout“abs of complex
b=“b.abscomplex()endl;
}

点击运行后没有显示错误和警告,但是出来一个对话框显示不能运行程序
回复

使用道具 举报

千问 | 2011-3-6 12:05:50 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">毛病不少,这是改过了的:
#includeiostream.h
#includemath.h
class complex{
private:
double real;
double image;
public:
complex (double r=0.0,double i=0.0)
{real=r; image=i;}
double realcomplex() {return real;}
double imagecomplex() {return image;}
double abscomplex()
{double t;
t = real*real image*image;
return sqrt(t);}
};


void main()
{complex a (1.1,2.2) ;
cout\"real of complex a=\"a.realcomplex()endl;
cout\"image of complex a=\"a.imagecomplex()endl;
cout\"abs of complex a=\"a.abscomplex()endl;
complex b;
cout\"real of complex b=\"b.realcomplex()endl;
cout\"image of complex b=\"b.imagecomplex()endl;
cout\"abs of complex b=\"b.abscomplex()endl;
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行