Question: 1. Write a C+ program that can determine the final equivalent resistance for a simple circuit with multiple resistors, and simplify the circuit into its
1. Write a C+ program that can determine the final equivalent resistance for a simple circuit with multiple resistors, and simplify the circuit into its equivalent circuit Your running outputs should be very similar to the examples given on the next page. In this problem you must create two functions and you must call both functions in your main function. 1) a function "series" which takes two resistances in series as inputs and return their combined resistance; 2) a function "parallel" which takes two resistances in parallel as inputs and return their combined resistance. (20 points) a) 44 in series: RTOTAL = R1+R2 Parallel: R 00R b) The user is prompted to enter the voltage and the first two resistances and how they are connected. Then the user is prompted to either enter a new resistance or finish entering resistance. The user also will enter if the newly entered resistor is either in series with or parallel to the previously determined total resistance. Therefore, the newly entered resistor can be combined with the previous total resistance accordingly, using one of the two functions. We assume the user will not enter invalid inputs. The resistance number in the prompt line changes correspondingly as well (see examples on the next page). (10 points) After all resistances have been entered, the correct total equlvalent resistance and the current in the main branch (calculated by Ohm's law, /- wR) are displayed. The display also shows how many resistances in total the user has entered. (20 points) c) d) Then the user is ahways prompted to either do a new round of calculation or quit the program. If the user decides to do another round of calculation, don't forget all values need to be resct! The program cannot end until the user decides so. (10 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
