|
<p>C++编译改错</p>
<p><img src="http://img.baidu.com/img/iknow/icn_point.gif"> 悬赏分:0 -</p>
<p>解决时间:2009-12-15 12:24</p>
<p>#include<iostream.h></p>
<p>class complex{</p>
<p>int x,y;</p>
<p>public:</p>
<p>complex( ){ }</p>
<p>complex(int i,int j ){x=i;y=j;}</p>
<p>complex operator +( complex &p)</p>
<p>{ complex t; t.x=x+p.x;t.y=y+p.y;return t;}</p>
<p>void show(){cout<<x<<"+"<<y<<"i"; }</p>
<p>};</p>
<p>void main()</p>
<p>{ complex p1(5,8),p2(5,2),p3;p1.operator +(p2); p3.show(); }</p>
<p>哪里错了???</p>
<p>提问者: wojiuaidahuang - 一级</p>
<p>最佳答案</p>
<p>p3 = p1.operator +(p2);</p>
<p>p3.show();</p>
<p>0</p>
<p>回答者:</p>
<p>匿名 2009-12-14 23:01</p>
<p>我来评论>></p>
<p>提问者对于答案的评价:</p>
<p>非常感谢</p>
|
|