-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneighbors.cpp
55 lines (44 loc) · 841 Bytes
/
neighbors.cpp
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
48
49
50
51
52
53
54
55
#include <iostream>
#include "neighbors.h"
using namespace std;
#ifndef neighbors_cpp
#define neighbors_cpp
neighbors::neighbors()
{
this->sourceNum=0;
this->destNum=0;
this->weight=0;
}
neighbors::neighbors(int sn,int w,int dn)
{
this->sourceNum=sn;
this->weight=w;
this->destNum=dn;
}
neighbors::neighbors(neighbors& n)
{
this->sourceNum=n.sourceNum;
this->destNum=n.destNum;
this->weight=n.weight;
}
int neighbors::getSource()
{
return this->sourceNum;
}
int neighbors::getDest()
{
return this->destNum;
}
int neighbors::getweight()
{
return this->weight;
}
ostream& operator <<(ostream& o,neighbors& n)
{
return o<<n.sourceNum<<" "<<n.destNum<<" "<<n.weight<<"\n"<<endl;
}
std::istream& operator >> (std::istream & is,neighbors & s)
{
return is >> s.sourceNum >> s.destNum >> s.weight;
}
#endif