为什么通不过编译?
为什么通不过编译?
#include<iostream.h>
class complex
{
private:
int real;
int imag;
public:
complex(int r=0,int i=0)
{
real=r;
imag=i;
}
friend complex operator +(complex &,complex &);
void show()
{
cout<<real<<"+"<<imag<<"i";
}
};
friend complex operator + (complex &a,complex &b)
{
int r1=a.real+b.real;
int i1=a.imag+b.imag;
return complex(r1,i1);
}
void main()
{
complex x(2,3),y(4,5),z;
z=x+y;
z.show();
}
#include<iostream.h>
class complex
{
private:
int real;
int imag;
public:
complex(int r=0,int i=0)
{
real=r;
imag=i;
}
friend complex operator +(complex &,complex &);
void show()
{
cout<<real<<"+"<<imag<<"i";
}
};
friend complex operator + (complex &a,complex &b)
{
int r1=a.real+b.real;
int i1=a.imag+b.imag;
return complex(r1,i1);
}
void main()
{
complex x(2,3),y(4,5),z;
z=x+y;
z.show();
}
...全文
相关推荐
ArcGIS Engine 10开发环境的一些常见问题
ArcGIS Engine 10开发环境的一些常见问题
我在编译ep9315时遇到
在编译ep9315板子时出现通不过的情况,改动了原文件就可通过.也不知为什么
PIC单片机编译通不过错误总汇
本文给大家分享了PIC单片机编译通不过错误总汇。
为什么debug编译不出错,而release编译会出错
该文档介绍了有的工程在debug中编译没有错误,可是在release下编译却报错的原因和解决方案,希望有助于大家学习。
在编译时为什么要加上 –lm ?
Linux 中常用链接来解决一些库函数的问题。在编译时链接可以生成可执行文件。了解一些链接的基本过程,能让我们在开发中减去不少的麻烦! 编译时使用 gcc -lm 程序功能很简单,下面的示例展示了exp()函数的用法。 (代码一) #include #include //exp int main(int argc, char const *argv[]){ //double x = 0; printf(The exponential value of %lf is %lf\n, 0, exp(0)); printf(The exponential value of %


