Question: IN C + + PLEASE I need help writing the function to find the resistors given the following code #include #include #include using namespace std;

IN C++ PLEASE I need help writing the function to find the resistors given the following code
#include
#include
#include
using namespace std;
struct Resistor {
string ID;
double resistance;
};
struct Node {
string ID;
bool ground;
vector connections;
};
void find_resistors(string n1, string n2, vector nodes){
//write function
int main(){
string n1, n2;
cin >> n1>> n2;
Resistor r1={"R1",2200.0};
Resistor r2={"R2",4700.0};
Resistor r3={"R3",10000.0};
Resistor r4={"R4",3300.0};
Resistor r5={"R5",4700.0};
Resistor r6={"R6",6800.0};
// Nodes
vector nodes(5);
nodes[0].ID ="N1";
nodes[0].ground = true;
nodes[0].connections.push_back(&r1);
nodes[0].connections.push_back(&r3);
nodes[1].ID ="N2";
nodes[1].connections.push_back(&r1);
nodes[1].connections.push_back(&r2);
nodes[2].ID ="N3";
nodes[2].connections.push_back(&r2);
nodes[2].connections.push_back(&r4);
nodes[2].connections.push_back(&r5);
nodes[3].ID ="N4";
nodes[3].connections.push_back(&r3);
nodes[3].connections.push_back(&r4);
nodes[3].connections.push_back(&r6);
nodes[4].ID ="N5";
nodes[4].connections.push_back(&r5);
nodes[4].connections.push_back(&r6);
find_resistors(n1, n2, nodes);
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!