Become a part of the TranceAddict community!Frequently Asked Questions - Please read this if you haven'tSearch the forums
TranceAddict Forums > Main Forums > Chill Out Room > Ohm's law......C++ PROG.....die c++ die!
  Last Thread   Next Thread
Share
Author
Thread    Post A Reply
PSi
Come to Daddy



Registered: Feb 2001
Location: Fort McMurray, AB
Hello! Ohm's law......C++ PROG.....die c++ die!

could you guys help me do this program, its simple but i just dont know how the hell to do it. Your help would be much appreciated.

http://www.cs.ncl.ac.uk/old/modules...csc601/ohm.html


many many thanks,

later
PSi

Old Post Nov-14-2002 15:41  Canada
Click Here to See the Profile for PSi Click here to Send PSi a Private Message Add PSi to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Swamper
Webmonstah



Registered: Jan 2000
Location: Toronto, Canada

You really should consider another course to take... That has to be the easiest thing they could ask you to do

...set up a loop with the menu structure asking for the values of at least two variables of IVR (IV, IR, VR) - exit when say a 'q'uit key is in input or whatever...

...and then from there jump to the calculation function(s) and output your result with the variables input... I guess you could use cases ...


___________________

"In a world of illusion you only see what you feel"

Old Post Nov-14-2002 16:01  Canada
Click Here to See the Profile for Swamper Click here to Send Swamper a Private Message Visit Swamper's homepage! Add Swamper to your buddy list Report this Post Reply w/Quote Edit/Delete Message
tranceaholic
chus & Ceballos addict



Registered: Mar 2002
Location: behind the decks

yeah it is a very simple progy..ask the user to make a choice

cin that choice...do a while loop to calulate the value of v=ir until the user cin's a q to quit for example...

Old Post Nov-14-2002 16:09  Egypt
Click Here to See the Profile for tranceaholic Click here to Send tranceaholic a Private Message Add tranceaholic to your buddy list Report this Post Reply w/Quote Edit/Delete Message
PSi
Come to Daddy



Registered: Feb 2001
Location: Fort McMurray, AB

pm tranceaholic.


yeah i see the overall kist of it, its just the syntax that i cant get over.


later
PSi

Old Post Nov-14-2002 16:15  Canada
Click Here to See the Profile for PSi Click here to Send PSi a Private Message Add PSi to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Cyrax
Supreme tranceaddict



Registered: May 2001
Location: Belgium

I don't remember Ohm's formula, but here you have the program, took 5 minutes to make.

replace the comment in the subprogram 'calc' by the correct formulas.

code:
#include #include #include #include #include #include // Cyrax Creations // [email protected] // // Ohm's law int i, v, r, choice; void input() { system("cls"); do { cout<<"\n\n"; cout<<"\t1. Calculate current\n"; cout<<"\t2. Calculate Voltage\n"; cout<<"\t3. Calculate Restistance\n\n"; cout<<"\t0. Quit\n\n\n"; cout<<"\t Enter your choice => "; cin>>choice; } while ((choice < 0) && (choice > 3)); } void calc() { if (choice == 1) { system("cls"); cout<<"\n\n\n"; cout<<"\tEnter Voltage => "; cin>>v; cout<<"\tEnter Resistance => "; cin>>r; // ENTER OHM'S FORMULA HERE // i = formula_here, remove double slash; cout<<"\n\n"; cout<<" Current = "<< i <<"."; cout<<"\n\n\n\n"; } if (choice == 2) { system("cls"); cout<<"\n\n\n"; cout<<"\tEnter Current => "; cin>>i; cout<<"\tEnter Resistance => "; cin>>r; // ENTER OHM'S FORMULA HERE // v = formula_here, remove double slash; cout<<"\n\n"; cout<<" Voltage = "<< v <<"."; cout<<"\n\n\n\n"; } if (choice == 3) { system("cls"); cout<<"\n\n\n"; cout<<"\tEnter Current => "; cin>>i; cout<<"\tEnter Voltage => "; cin>>v; // ENTER OHM'S FORMULA HERE // r = formula_here, remove double slash; cout<<"\n\n"; cout<<" Resistance = "<< r <<"."; cout<<"\n\n\n\n"; } } void main() { input(); calc(); }


greetz

Cyrax

Old Post Nov-14-2002 22:10  Belgium
Click Here to See the Profile for Cyrax Click here to Send Cyrax a Private Message Visit Cyrax's homepage! Add Cyrax to your buddy list Report this Post Reply w/Quote Edit/Delete Message
tranceaholic
chus & Ceballos addict



Registered: Mar 2002
Location: behind the decks

by the way the formula is V=IR

Old Post Nov-14-2002 23:06  Egypt
Click Here to See the Profile for tranceaholic Click here to Send tranceaholic a Private Message Add tranceaholic to your buddy list Report this Post Reply w/Quote Edit/Delete Message
<tuss>
trance plant.



Registered: Sep 2001
Location: calgary canada

ohms law
V=I/R
I=V*R
R=I/V

I think


___________________

Old Post Nov-15-2002 00:07  Canada
Click Here to See the Profile for <tuss> Click here to Send <tuss> a Private Message Visit <tuss>'s homepage! Add <tuss> to your buddy list Report this Post Reply w/Quote Edit/Delete Message
reveal
always in the mix



Registered: May 2001
Location: Sweden

U = RI


___________________
man with no sig

Old Post Nov-15-2002 01:02 
Click Here to See the Profile for reveal Click here to Send reveal a Private Message Add reveal to your buddy list Report this Post Reply w/Quote Edit/Delete Message
tranceaholic
chus & Ceballos addict



Registered: Mar 2002
Location: behind the decks

it is V=IR and I=V/R...v is the voltage or potensial difference and I is the current and R is the resistance...ohms law satets that the voltage is directly proportional to the current intensity and the resistance hence V=IR

Old Post Nov-15-2002 01:04  Egypt
Click Here to See the Profile for tranceaholic Click here to Send tranceaholic a Private Message Add tranceaholic to your buddy list Report this Post Reply w/Quote Edit/Delete Message
Photo_bot_2k1
Photo_bot_2k5 ;D



Registered: Jan 2002
Location: Berkeley,CA

i agree with swamper
and cyrax u like made it mroe cmoplicated than it acctualyl is :P


___________________

Old Post Nov-15-2002 01:42  United States
Click Here to See the Profile for Photo_bot_2k1 Click here to Send Photo_bot_2k1 a Private Message Add Photo_bot_2k1 to your buddy list Report this Post Reply w/Quote Edit/Delete Message
SmellsExcellent
fuckedupandconfused



Registered: Dec 2001
Location: Shangri-La

quote:
Originally posted by Photo_bot_2k1
i agree with swamper
and cyrax u like made it mroe cmoplicated than it acctualyl is :P


i second both of those...

all you need is a quick menu guy, the inputs, and functions to calculate the different things.. sould be less than 40 lines of code or so....

-Marc


___________________

no obstacles between my heart and my words; my lips, the great liaison to my soul.

Old Post Nov-15-2002 21:02 
Click Here to See the Profile for SmellsExcellent Click here to Send SmellsExcellent a Private Message Add SmellsExcellent to your buddy list Report this Post Reply w/Quote Edit/Delete Message

TranceAddict Forums > Main Forums > Chill Out Room > Ohm's law......C++ PROG.....die c++ die!
Post New Thread    Post A Reply

 
Last Thread   Next Thread
Click here to listen to the sample!Pause playbacktune from above n beyond set [2005] [4]

Click here to listen to the sample!Pause playbackAquaflow - God's Creation [2002]

Show Printable Version | Subscribe to this Thread
Forum Jump:

All times are GMT. The time now is 15:54.

Forum Rules:
You may not post new threads
You may not post replies
You may not edit your posts
HTML code is ON
vB code is ON
[IMG] code is ON
 
Search this Thread:

 
Contact Us - return to tranceaddict

Powered by: Trance Music & vBulletin Forums
Copyright ©2000-2026, Jelsoft Enterprises Ltd.
Privacy Statement / DMCA
Support TA!