0
I need help with writing a code in c++ to calculate resistors in series-parallel?
8 Antworten
+ 3
No, you need help refining your question first. Be specific: what's your given input, and what's your desired output? eg are you calculating total effective resistance for a circuit, or voltage across / current through a given resistor, or ... ?
Also, not everyone here has a science background, so you'll probably wanna provide all relevant physical formulas as well (presumably just Ohm's law, in this case)
+ 2
Upload your attempt. You should read this: https://code.sololearn.com/Wek0V1MyIR2r/?ref=app
+ 1
winston
I saw the topic you are given in your profile.
However, it is not clear how the inputs are going to be obtained.
How are the values inputted?
How would you know which components are connected and how are they connected(series or parallel)?
The conversion of formula to code is fairly straightforward, but what are the inputs and how are they obtained needs to be specified so you can set up your code properly.
Also, how much C++ have you written?
Do you have at least a rough code for us to see?
+ 1
I assume we will have to ask the user for the inputs and how the components are connected so the code will have to decide base on the different scenarios a user may input.
+ 1
I will send the code that I have written shortly.
+ 1
Thank you.
0
winston
maybe something like this could be helpful as a starting point.
http://codepad.org/cXqspRn9
https://cplusplus.com/forum/general/237231/
https://anumana8.medium.com/circuit-design-using-programming-c-69399b0907b
0
winston
off topic, but here are links to interesting sites where you can set up and analyze circuits graphically, to illustrate how a gui can make things a lot more interactive.
https://www.falstad.com/circuit/circuitjs.html
https://www.circuitlab.com/editor/#?id=7pq5wm&from=homepage