12 friend ostream
& operator<<(ostream
& outs
, A1 one
);
22 A1
operator+=(int value
);
23 A1
operator+(const A1
&);
24 A1
operator-(const A1
&);
25 A1
operator%(const A1
&);
26 int operator==(const A1
&);
27 int operator!=(const A1
&);
28 int operator&&(const A1
&);
29 int operator||(const A1
&);
32 A1
operator|(const A1
&);
33 A1
operator^(const A1
&);
34 A1
operator&(const A1
&);
35 int operator<(const A1
&);
36 int operator<=(const A1
&);
37 int operator>=(const A1
&);
38 int operator>(const A1
&);
39 A1
operator*(const A1
&);
40 A1
operator/(const A1
&);
41 A1
operator=(const A1
&);
54 A1
A1::operator+(const A1
& second
)
63 A1
A1::operator*(const A1
& second
)
66 product
.x
= this->x
* second
.x
;
67 product
.y
= this->y
* second
.y
;
72 A1
A1::operator-(const A1
& second
)
75 diff
.x
= x
- second
.x
;
76 diff
.y
= y
- second
.y
;
81 A1
A1::operator/(const A1
& second
)
90 A1
A1::operator%(const A1
& second
)
99 int A1::operator==(const A1
& second
)
101 int a
= (x
== second
.x
);
102 int b
= (y
== second
.y
);
107 int A1::operator!=(const A1
& second
)
109 int a
= (x
!= second
.x
);
110 int b
= (y
!= second
.y
);
115 int A1::operator&&(const A1
& second
)
117 return ( x
&& second
.x
);
120 int A1::operator||(const A1
& second
)
122 return ( x
|| second
.x
);
125 A1
A1::operator<<(int value
)
128 lshft
.x
= x
<< value
;
129 lshft
.y
= y
<< value
;
134 A1
A1::operator>>(int value
)
137 rshft
.x
= x
>> value
;
138 rshft
.y
= y
>> value
;
143 A1
A1::operator|(const A1
& second
)
146 abitor
.x
= x
| second
.x
;
147 abitor
.y
= y
| second
.y
;
152 A1
A1::operator^(const A1
& second
)
155 axor
.x
= x
^ second
.x
;
156 axor
.y
= y
^ second
.y
;
161 A1
A1::operator&(const A1
& second
)
164 abitand
.x
= x
& second
.x
;
165 abitand
.y
= y
& second
.y
;
170 int A1::operator<(const A1
& second
)
174 return (x
< second
.x
);
177 int A1::operator<=(const A1
& second
)
179 return (x
<= second
.x
);
182 int A1::operator>=(const A1
& second
)
184 return (x
>= second
.x
);
187 int A1::operator>(const A1
& second
)
189 return (x
> second
.x
);
192 int A1::operator!(void)
197 A1
A1::operator-(void)
206 A1
A1::operator~(void)
215 A1
A1::operator++() // pre increment
222 A1
A1::operator++(int) // post increment
229 A1
A1::operator--() // pre decrement
236 A1
A1::operator--(int) // post decrement
244 A1
A1::operator=(const A1
& second
)
253 A1
A1::operator+=(int value
)
262 ostream
& operator<<(ostream
& outs
, A1 one
)
264 return (outs
<< endl
<< "x = " << one
.x
<< endl
<< "y = " << one
.y
<< endl
<< "-------" << endl
);
278 cout
<< "+ " << three
;
280 cout
<< "- " << three
;
282 cout
<<"* " << three
;
284 cout
<< "/ " << three
;
286 cout
<< "% " << three
;
288 cout
<< "| " <<three
;
290 cout
<< "^ " <<three
;
292 cout
<< "& "<< three
;
295 cout
<< "&& " << val
<< endl
<< "-----"<<endl
;
297 cout
<< "|| " << val
<< endl
<< "-----"<<endl
;
299 cout
<< " == " << val
<< endl
<< "-----"<<endl
;
301 cout
<< "!= " << val
<< endl
<< "-----"<<endl
;
303 cout
<< ">= " << val
<< endl
<< "-----"<<endl
;
305 cout
<< "<= " << val
<< endl
<< "-----"<<endl
;
307 cout
<< "< " << val
<< endl
<< "-----"<<endl
;
309 cout
<< "> " << val
<< endl
<< "-----"<<endl
;
312 cout
<< "lsh " << three
;
314 cout
<< "rsh " << three
;
317 cout
<< " = "<< three
;
319 cout
<< " += "<< three
;
322 cout
<< "! " << val
<< endl
<< "-----"<<endl
;
324 cout
<< "- " << three
;
326 cout
<< " ~" << three
;
328 cout
<< "postinc " << three
;
330 cout
<< "postdec " << three
;
333 cout
<< "predec " << three
;
335 cout
<< "preinc " << three
;