-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResistor.cpp
More file actions
61 lines (50 loc) · 1.05 KB
/
Copy pathResistor.cpp
File metadata and controls
61 lines (50 loc) · 1.05 KB
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
56
57
58
59
#include "Resistor.h"
#include <iomanip>
//constructor
Resistor::Resistor()
{}
//constructor
// _node represents the the node in which the ResistorList is part of while
// _othernode represents the resistor's other connecting node
Resistor::Resistor(string _name, double _resistance, int _node, int _othernode)
:label(_name), resistance(_resistance)
{
endpoints[0] = _node;
endpoints[1] = _othernode;
nextResistor = NULL;
}
//get the next resistor
Resistor* Resistor::getNext()
{
return nextResistor;
}
//get the resistor's name
string Resistor::getName()
{
return label;
}
//set the pointer to the next resistor
void Resistor::setNext(Resistor* _r)
{
nextResistor = _r;
}
//set the value of the resistor
void Resistor::setVal(string _name, double _resistance)
{
resistance = _resistance;
}
//return the resistance
double Resistor::getResistance()
{
return resistance;
}
//obtain the first endpoint
int Resistor::getEndPointOne()
{
return endpoints[0];
}
//return the second endpoint
int Resistor::getEndPointTwo()
{
return endpoints[1];
}