#include<bits/stdc++.h>
using namespace std;
class VT{
private :
float a,b,c;
public :
friend istream& operator>> ( istream& x,VT & y ) ;
friend ostream& operator<< ( ostream& x,VT y) ;
VT operator+ ( VT y) ;
bool operator> ( VT y) ;
} ;
istream& operator>> ( istream& x,VT & y ) {
cout << "nhap a=" ; x>> y.a ;
cout << "nhap b=" ; x>> y.b ;
cout << "nhap c=" ; x>> y.c ;
return x;
}
ostream& operator<< ( ostream& x,VT y ) {
x<< "(" << y.a << "," << y.b << "," << y.c << ")" << endl;
return x;
}
VT VT:: operator + ( VT y) {
VT u;
u.a = a+ y.a ;
u.b = b+ y.b ;
u.c = c+ y.c ;
return u;
}
bool VT:: operator > ( VT y) {
if ( a> y.a && b> y.b && c> y.c )
return true ;
else return false ;
}
int main( ) {
VT u,v;
cout << "Nhap thong tin Vecto u: " << endl;
cin >> u;
cout << "Nhap thong tin Vecto v: " << endl;
cin >> v;
cout << "Thong tin vecto u" << endl;
cout << u<< endl;
cout << "Thong tin vecto v" << endl;
cout << v<< endl;
VT m= u+ v;
cout << "tong 2 vecto" << m<< endl;
if ( u> v== true ) {
cout << "vecto u lon hon vecto v!" << endl;
}
else {
cout << "vecto u khong lon hon vecto v!" << endl;
}
ofstream f( "VT.txt" ) ;
f<< "Tong 2 vecto" << m<< endl;
return 0 ;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY2xhc3MgVlR7Cglwcml2YXRlOgoJCWZsb2F0IGEsYixjOwoJcHVibGljOgoJCWZyaWVuZCBpc3RyZWFtJm9wZXJhdG9yPj4oaXN0cmVhbSZ4LFZUICZ5ICk7CgkJZnJpZW5kIG9zdHJlYW0mb3BlcmF0b3I8PChvc3RyZWFtJngsVlQgeSk7CgkJVlQgb3BlcmF0b3IrKFZUIHkpOwoJCWJvb2wgb3BlcmF0b3I+KCBWVCB5KTsKfTsKaXN0cmVhbSZvcGVyYXRvcj4+KGlzdHJlYW0meCxWVCAmeS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