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 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
N
N
then the output should be
R
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:
N
N
Output:
No resistors found.
Use the template provided below and complete the code for the function findresistors.
Code:
#include
#include
#include
using namespace std;
struct Resistor
string ID;
double resistance;
;
struct Node
string ID;
bool ground;
vector connections;
;
void findresistorsstring n string n vector nodes
TODO: complete this function
int main
TODO: Declare string variables n n Read two node IDs from cin.
Copy relevant code from Lab main function code here
TODO: write this function:
findresistorsn n nodes;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
