-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperators.cpp
More file actions
47 lines (42 loc) · 923 Bytes
/
Copy pathoperators.cpp
File metadata and controls
47 lines (42 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
///////////////////////////////////////////////////////////////////////////////
//operators
#include "operators.h"
ostream& operator<<(ostream &fout,Point p)
{
fout<<p.x<<"\t"<<p.y;
return fout;
}
istream& operator>>(istream &fin,Point &p)
{
fin>>p.x>>p.y;
return fin;
}
bool operator==(color a, color b)
{
if(a.ucRed==b.ucRed && a.ucGreen==b.ucGreen && a.ucBlue==b.ucBlue)
return true;
else
return false;
}
ostream& operator<<(ostream &out,color c)
{
if(c==BLACK)out<<"BLACK";
else if(c==WHITE)out<<"WHITE";
else if(c==BLUE)out<<"BLUE";
else if(c==GREEN)out<<"GREEN";
else if(c==RED)out<<"RED";
else if(c==INDIAN)out<<"INDIAN";
return out;
}
istream& operator>>(istream &in, color &c)
{
string cs;
in>>cs;
if(cs=="BLACK") c=BLACK;
else if(cs=="WHITE") c=WHITE;
else if(cs=="BLUE") c=BLUE;
else if(cs=="GREEN") c=GREEN;
else if(cs=="RED") c=RED;
else if(cs=="INDIAN") c=INDIAN;
return in;
}