0

please help,

can anyone solve this code #include<iostream> using namespace std; template<class T> class RGB{ public: T x,y; RGB(T tx,T ty){ x=tx; y=ty; } RGB operator-=(RGB t); RGB operator/=(RGB t); friend std::ostream & operator<< <T>(std::ostream & out, RGB<T> & ); }; template <class T> RGB <T> RGB<T>::operator-=(RGB t){ x-=t.x; y-=t.y; return *this; } template<class T> /* TODO (#1#): > */ RGB<T> RGB <T>::operator/=(RGB t){ x/=t.x; y/=t.x; return *this; } template<class T> ostream&operator<<(ostream &out,RGB<T>t){ out<<t.x<<' '<<t.y<<endl; return out; }void main(){ RGB<int>t(1,2),t1(2,3),t2(3,4); cout<<"t="<<t; cout<<"t1="<<t1; cout<<"t2="<<t2; t-=t1; cout<<"t-"<<"t1"<<t; t1/=t2; cout<<"t/"<<"t1"<<t1<<endl; RGB<float>p(1.1,2.2),p1(2.3,3.4),p2(3.5,4.6); cout<<"p="<<p; cout<<"p1="<<p1; cout<<"p2="<<p2; p1-=p; cout<<"p1-"<<"p="<<p; p2/=p1; cout<<"p1/"<<"p2"<<p1; cin.get(); }

4th Nov 2019, 2:16 AM
jak Leito
jak Leito - avatar
0 Réponse