Click here to Skip to main content
15,908,013 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Lots of free stuff on VC++ Pin
Christian Graus17-Mar-04 8:35
protectorChristian Graus17-Mar-04 8:35 
GeneralRe: Lots of free stuff on VC++ Pin
Sudhir Mangla17-Mar-04 16:30
professionalSudhir Mangla17-Mar-04 16:30 
GeneralMSComm Control Pin
Nguyen Duc Thang9-Mar-04 16:57
Nguyen Duc Thang9-Mar-04 16:57 
GeneralRe: MSComm Control Pin
Branislav9-Mar-04 19:25
Branislav9-Mar-04 19:25 
QuestionSetting a bitmap to a button? Pin
MeterMan9-Mar-04 16:54
MeterMan9-Mar-04 16:54 
AnswerRe: Setting a bitmap to a button? Pin
valikac9-Mar-04 17:07
valikac9-Mar-04 17:07 
GeneralRe: Setting a bitmap to a button? Pin
MeterMan9-Mar-04 19:12
MeterMan9-Mar-04 19:12 
GeneralNeed help with personal project.... Pin
Jodieluv9-Mar-04 15:58
Jodieluv9-Mar-04 15:58 
I am need of some help, I am new at c + + and want to design this program.

Objective: Write a program that uses a class to perform tasks.

Write a program that calculates and displays the electrical current flowing through a circuit, the voltage across each resistor, and power dissipated by each of two resistors in a simple series circuit. The series circuit consists of a single voltage source with two resistors in series across the voltage source outputs.

Use a class to hold the two resistor values and the voltage. The class should also have functions to calculate the current flowing through the series circuit (voltage/ (resistorA+resistorB)), the voltage drop across each resistor (two functions), and the power dissipated by each resistor (two functions). There are five functions in total. Each of these functions returns a double.

The voltage drop across resistor1 is (resistor1 * voltage)/(resistor1 + resistor2). The voltage drop across resistor2 is (resistor2 * voltage)/(resistor1 + resistor2).

Power can be calculated by squaring the voltage drop across the resistor and dividing this by the resistance. The function that returns the voltage can be used to get the voltage as shown below:

powerR1 = VoltageR1 ()*VoltageR1 ()/resistor1;

VoltageR1() is the class function that returns the voltage drop across resistor 1 and resistor1 is the value of resistor 1.

The program should execute in a loop. Inside the loop ask the user to enter the source voltage. Read the value entered and assign it to an appropriately named member of the class. Next prompt the user to enter a value for the first resistor. Assign this value to an appropriately named member of the class. Next prompt the user to enter a value for the second resistor and assign this value to an appropriately named member of the class. After the values are entered, prompt the user to enter either V, P or C. If a V is entered display the voltages across each of the resistors, if a P is entered display the power dissipated by each of the resistors, and if a C is entered display the current through the circuit. Letters can be either lower or upper case.

After the above information is displayed prompt the program user to enter y to continue with new values and another calculation.

Put the declaration/definition for the class in a header file. Be sure to save the file in the project folder and add the header file to project. Put the class functions/methods in another .cpp file and add this to the project. Put the code with a main that makes an instance of the class in another .cpp file and make sure that is in project.


jodie
GeneralRe: Need help with personal project.... Pin
Christian Graus9-Mar-04 17:20
protectorChristian Graus9-Mar-04 17:20 
GeneralRe: Need help with personal project.... Pin
Jodieluv12-Mar-04 9:00
Jodieluv12-Mar-04 9:00 
GeneralRe: Need help with personal project.... Pin
Christian Graus14-Mar-04 9:02
protectorChristian Graus14-Mar-04 9:02 
GeneralRe: Need help with personal project.... Pin
Jodieluv15-Mar-04 5:06
Jodieluv15-Mar-04 5:06 
GeneralRe: Need help with personal project.... Pin
l a u r e n9-Mar-04 20:15
l a u r e n9-Mar-04 20:15 
GeneralRe: Need help with personal project.... Pin
MeterMan12-Mar-04 20:44
MeterMan12-Mar-04 20:44 
GeneralNeed help with personal project.... Pin
Jodieluv9-Mar-04 15:55
Jodieluv9-Mar-04 15:55 
GeneralInteract with Windows Mediaplayer Pin
Chen Pang9-Mar-04 15:47
Chen Pang9-Mar-04 15:47 
GeneralStatic example compilation problem Pin
rmnowick9-Mar-04 15:47
rmnowick9-Mar-04 15:47 
Generalhelp with a simple program that use structure Pin
bishead9-Mar-04 15:44
bishead9-Mar-04 15:44 
GeneralRe: help with a simple program that use structure Pin
Christian Graus9-Mar-04 17:17
protectorChristian Graus9-Mar-04 17:17 
GeneralRe: help with a simple program that use structure Pin
Prakash Nadar9-Mar-04 17:28
Prakash Nadar9-Mar-04 17:28 
GeneralRe: help with a simple program that use structure Pin
Roger Wright9-Mar-04 19:03
professionalRoger Wright9-Mar-04 19:03 
GeneralRe: help with a simple program that use structure Pin
Prakash Nadar9-Mar-04 19:07
Prakash Nadar9-Mar-04 19:07 
GeneralRe: help with a simple program that use structure Pin
Roger Wright9-Mar-04 19:26
professionalRoger Wright9-Mar-04 19:26 
GeneralRe: help with a simple program that use structure Pin
Prakash Nadar10-Mar-04 5:25
Prakash Nadar10-Mar-04 5:25 
QuestionHow to get system time to micro second? Pin
freehawk9-Mar-04 15:15
freehawk9-Mar-04 15:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.