Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C (http://www.programmingforums.org/forum60.html)
-   -   New to c programming...don't know where to start (http://www.programmingforums.org/showthread.php?t=15048)

WalterSlopeboi Jan 27th, 2008 5:39 AM

New to c programming...don't know where to start
 
I am new to c programming and I cannot understand the teacher for the life of me. It becomes very difficult to learn this stuff even just by reading. I have this assignment that is due on Tuesday and I was wondering if anybody could help me out. I'd greatly appreciate it...

1. The program asks for the user to input the magnitudes and angles for two vectors, A and B. It then calculates the resultant vector (R) by summing the X- and Y-components of the two vectors, and prints the magnitudes, and angles (with respect to X-axis) of the vectors A, B, and R.

2. The program asks for the user to input the source voltage, E, and resistance of three resistors, R1, R2, R3. If then calculates the equivalent resistance R_equiv, the current, 1, and the power consumed by the circuit, P.


Where do I even begin?

Grich Jan 27th, 2008 6:53 AM

Re: New to c programming...don't know where to start
 
Do your own homework.

Salem Jan 27th, 2008 6:54 AM

Re: New to c programming...don't know where to start
 
- print the prompts for the questions you want to ask
- read the responses from the user
- print the responses back to the user.

Ensuring that you can perform the initial "Q&A" session with the user, and can read their inputs correctly is a useful first step.

As for the calculations, you need a math reference which explains vector addition and an electronics reference which explains how resistance works. Immediately, a further question then becomes as to how the 3 resistors are wired (in series or in parallel).

Jessehk Jan 27th, 2008 10:23 AM

Re: New to c programming...don't know where to start
 
My first question would be what the specific problem is.
Do you understand the math required for each assignment (in which case only the programming is the problem)? If so, write out some pseudo-code for each assignment. At that point, we'll help you convert it to code.

Here's an example of "pseudo-code", it describes what's to be done:
:

for x : 1 to 10
    read an integer
    print the integer
end


colin mac Jan 27th, 2008 11:12 AM

Re: New to c programming...don't know where to start
 
1. See converting from polar to cartesian and from cartesian to polar.

2. See resistors in series or parallel formula, Ohm's law and P = VI.


All times are GMT -5. The time now is 3:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC