14 friend ostream
& operator<<(ostream
& outs
, A1 one
);
24 A1
operator+=(int value
);
25 A1
operator+(const A1
&);
26 A1
operator-(const A1
&);
27 A1
operator%(const A1
&);
28 int operator==(const A1
&);
29 int operator!=(const A1
&);
30 int operator&&(const A1
&);
31 int operator||(const A1
&);
34 A1
operator|(const A1
&);
35 A1
operator^(const A1
&);
36 A1
operator&(const A1
&);
37 int operator<(const A1
&);
38 int operator<=(const A1
&);
39 int operator>=(const A1
&);
40 int operator>(const A1
&);
41 A1
operator*(const A1
&);
42 A1
operator/(const A1
&);
43 A1
operator=(const A1
&);
56 A1
A1::operator+(const A1
& second
)
65 A1
A1::operator*(const A1
& second
)
68 product
.x
= this->x
* second
.x
;
69 product
.y
= this->y
* second
.y
;
74 A1
A1::operator-(const A1
& second
)
77 diff
.x
= x
- second
.x
;
78 diff
.y
= y
- second
.y
;
83 A1
A1::operator/(const A1
& second
)
92 A1
A1::operator%(const A1
& second
)
101 int A1::operator==(const A1
& second
)
103 int a
= (x
== second
.x
);
104 int b
= (y
== second
.y
);
109 int A1::operator!=(const A1
& second
)
111 int a
= (x
!= second
.x
);
112 int b
= (y
!= second
.y
);
117 int A1::operator&&(const A1
& second
)
119 return ( x
&& second
.x
);
122 int A1::operator||(const A1
& second
)
124 return ( x
|| second
.x
);
127 A1
A1::operator<<(int value
)
130 lshft
.x
= x
<< value
;
131 lshft
.y
= y
<< value
;
136 A1
A1::operator>>(int value
)
139 rshft
.x
= x
>> value
;
140 rshft
.y
= y
>> value
;
145 A1
A1::operator|(const A1
& second
)
148 abitor
.x
= x
| second
.x
;
149 abitor
.y
= y
| second
.y
;
154 A1
A1::operator^(const A1
& second
)
157 axor
.x
= x
^ second
.x
;
158 axor
.y
= y
^ second
.y
;
163 A1
A1::operator&(const A1
& second
)
166 abitand
.x
= x
& second
.x
;
167 abitand
.y
= y
& second
.y
;
172 int A1::operator<(const A1
& second
)
176 return (x
< second
.x
);
179 int A1::operator<=(const A1
& second
)
181 return (x
<= second
.x
);
184 int A1::operator>=(const A1
& second
)
186 return (x
>= second
.x
);
189 int A1::operator>(const A1
& second
)
191 return (x
> second
.x
);
194 int A1::operator!(void)
199 A1
A1::operator-(void)
208 A1
A1::operator~(void)
217 A1
A1::operator++() // pre increment
224 A1
A1::operator++(int) // post increment
231 A1
A1::operator--() // pre decrement
238 A1
A1::operator--(int) // post decrement
246 A1
A1::operator=(const A1
& second
)
255 A1
A1::operator+=(int value
)
264 ostream
& operator<<(ostream
& outs
, A1 one
)
266 return (outs
<< endl
<< "x = " << one
.x
<< endl
<< "y = " << one
.y
<< endl
<< "-------" << endl
);
280 cout
<< "+ " << three
;
282 cout
<< "- " << three
;
284 cout
<<"* " << three
;
286 cout
<< "/ " << three
;
288 cout
<< "% " << three
;
290 cout
<< "| " <<three
;
292 cout
<< "^ " <<three
;
294 cout
<< "& "<< three
;
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
;
311 cout
<< "> " << val
<< endl
<< "-----"<<endl
;
314 cout
<< "lsh " << three
;
316 cout
<< "rsh " << three
;
319 cout
<< " = "<< three
;
321 cout
<< " += "<< three
;
324 cout
<< "! " << val
<< endl
<< "-----"<<endl
;
326 cout
<< "- " << three
;
328 cout
<< " ~" << three
;
330 cout
<< "postinc " << three
;
332 cout
<< "postdec " << three
;
335 cout
<< "predec " << three
;
337 cout
<< "preinc " << three
;