Witam wszystkich, proszę o sprawdzenie poprawności tego programu, przy kompilacji wyrzuca mi dziwny błąd C4244 :/
#include <iostream>
using namespace std;
class TKOLO
{
float R,Px,Py;
public:
TKOLO(float r,float px,float py);
TKOLO(float r);
TKOLO();
~TKOLO()
{
}
float pole()
{
return (3.14*R*R);
}
friend void drukuj(TKOLO z);
friend TKOLO operator + (TKOLO T1, TKOLO T2);
};
TKOLO::TKOLO(float r,float px,float py)
{
R=r;
Px=px;
Py=py;
}
TKOLO::TKOLO(float r)
{
R=r;
Px=0;
Py=0;
}
TKOLO::TKOLO()
{
R=0;
Px=0;
Py=0;
}
void drukuj(TKOLO z)
{
cout<<"R="<<z.R<<",["<<z.Px<<","<<z.Py<<"]"<<endl;
}
TKOLO operator + (TKOLO T1, TKOLO T2)
{
TKOLO A(0,0,0);
A.R=(T1.R+T2.R);
A.Px=((T1.Px+T2.Py)/2);
A.Py=((T1.Py+T2.Py)/2);
return A;
}
int main()
{
TKOLO T1(1,2,2),T2(1,2,3),T3,T4;
cout<<"T1= "; drukuj(T1); cout<<endl;
cout<<"T2= "; drukuj(T2); cout<<endl;
T4=T1+T2;
cout<<"T1+T2= "<< T4;
}