Question: IN C + + PLEASE This lab is an extension of 1 2 . 9 . The lab's objective is to list the resistors found

IN C++ PLEASE
This lab is an extension of 12.9. The lab's objective is to list the resistors found between two nodes.
Your program should read two node IDs from the console (one per line). Then, it must list the IDs of the resistors that are directly connected to the two nodes. For example, if the input is
N1
N2
then the output should be
R1
If the nodes are not adjacent (and therefore no resistors are connected to both nodes), a message should be printed as in the following example. Input:
N1
N5
Output:
No resistors found.
Use the template provided below and complete the code for the function find_resistors.
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){
// TODO: complete this function
}
int main(){
// TODO: Declare string variables n1, n2. Read two node IDs from cin.
// Copy relevant code from Lab 12.9 main() function code here
// TODO: write this function:
find_resistors(n1, n2, nodes);
return 0;
}
IN C + + PLEASE This lab is an extension of 1 2 .

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 Programming Questions!