- This topic has 6 replies, 4 voices, and was last updated 16 years ago by s-eye.
-
AuthorPosts
-
September 16, 2007 at 6:28 pm #191189s-eyeMember
hello everyone.. i need help from any C++ coder… i tired but i got a lot of errors in th eprogram .. can someone please help me out with this program
Create an ASCII Art representation of a simple parallel or series circuit using cout and proper formatting statements, similar to the circuit shown below, with the following components:
============================================================
Part II
Write a program that uses Ohms law (V = I * R, where V is the voltage in volts, I is the current in amps, and R is the resistance in Ohms) to solve a basic 3-resistors parallel or series circuit problem with a fixed DC voltage source rated at 12 VDC.First, your program should display a brief description of its operation and then ask the user to choose either a single source 3-resistors series circuit or a parallel circuit with the same specs.
Next, program prompts the user for the resistance values R1, R2, R3 and then computes and displays the voltage values across these resistors, the currents through each, and the total current supplied by the voltage source. Finally, program will calculate the total power supplied by the voltage source using the P = V * I, and the equivalent resistance as seen by the voltage source. You should use cout and cin for the output and input, respectively. Display the results in floating point format with a field width of 10 characters, three decimal point digits, and right-justified.
Use a while and switch structure to analyze each circuit based on that circuit’s component values. Within the switch, prompt the user to enter the appropriate data your program needs to calculate the voltages, currents, and total power based on that circuit resistor values.
Sample Output:
Select from the following circuit types:
1) Three-resistors Parallel Circuit
2) Three-resistors Series Circuit
3) Quit ProgramEnter Your Choice: 1
Three-resistors Parallel Circuit SelectedEnter value for R1 in Ohms: 4700
Enter value for R1 in Ohms: 6800
Enter value for R1 in Ohms: 8200
Voltage across R1 = 12 VDC
Voltage across R2 = 12 VDC
Voltage across R3 = 12 VDCCurrent through R1 = 2.553 mA
Current through R2 = 1.765 mA
Current through R1 = 1.463 mATotal power = 69.372 mW
Equivalent Resistance = 2075.765 Ω
Would you like to do another circuit analysis? (Y/N):thanks so much
September 19, 2007 at 6:10 am #191195s-eyeMemberplease please i need someone help..
September 19, 2007 at 4:35 pm #191194autopilotMemberwhy don’t you upload your project source code and then people can look at it to see if they can help you.
September 19, 2007 at 10:05 pm #191193ChikeMemberLOL you want us to do your homework dude? That’s like cheating.
What format statments? I missed that class LOL.September 20, 2007 at 6:30 am #191192s-eyeMemberhello
i tired to make it but it gives me a lot of errors ….
i want my program to work an infinite number of times, meaning that someone can go through it over and over again. So for that you need a while loop, so this is how the logic of your program should work, while the user wants to run the program, allow them to choose one of three options, if option 1 do series circuit, if option 2 do parallel circuit, if option 3 quit the program. Then switch, case 1 do series circuit, case 2 do parallel circuit, case 3 quit program. and finally if the user chooses three, then you want the while loop to be come false.. this is the idea of the program but still so far i got many errors …. it is a project and i ask someone to hel because i found hard to me .. its a help dude
thanks
September 20, 2007 at 12:47 pm #191191ChikeMemberOk, you just forgot one thing…. the source files LOL.
When you edit the post you click the “Upload attachement” below it, and add your source files, then send the post along with other info ou can give, like what kind off errors you get.
The more information you give, the more likely ppl will be able to assist you.January 10, 2008 at 7:54 pm #191190DodyMemberI don’t know if you solved your problem or not
but if you are using the 8051 siemens, then I can give you my full project
I almost done something similar some time ago (as good as I can remember 🙂 )though my code is a plain C with some special headers of the uVision platform
best wishes..
-
AuthorPosts
Related
- You must be logged in to reply to this topic.