# homework giving difficulty

• 09-13-2002
jjj
homework giving difficulty
I am working on my homework code. I am having difficulty organizing. I just need the right functions(calling them is easy).
And I don't know how to print out a table that is asked for(we go way fast in this class, I don't know why).

here is the link for all that I have to do, it isn' t so much because they tell you what to do.

http://www.engineering.uiowa.edu/~ci...ll02/hw02.html

here is my code anyways. the last function is supposed to print out a table, max of 50 stars(b/c voltage max);
Code:

``` lude <stdio.h> float read_positive(void); float calc_tau(float r, float c); float calc_v_of_t(float v, float tua, float t); void print_bar(float value, float max); int main() { float voltage, resistance, capacitance; printf( "please put in the voltage source voltage, units of volts" ); scanf( "%f", &voltage ); printf( "please put in the resistor resistance, in ohms units" ); scanf( "%f", &resistance ); printf( "please put in the capacitance" ); scanf( "%f", %capacitance ); return 0; } float read_positive(void) { printf( "Please put in a real number" ); scanf( "%d", &r ); return r; } float calc_tau(float r, float c) { float r, c, tau; printf( "please put in your resistor resistance in units of kiloohms for an accurate answer" ); scanf( "%f", &r ); printf( "please put in your capacitance in units of micofarads for an accurate answer" ); scanf( "%f", &c ); tau = r * c; return tau; } float calc_v_of_t(float v, float tua, float t) { printf( "and please put in the time for the circuit to run as a closed circuit, units of seconds" ); scanf( "%f", t); v = v - v*(e^(-t/tau); return v; } void print_bar(float value, float max) { }```
I talked to my TA about it, but they sometimes don't make any sense. they communicate different, sometimes they do though.

void print_bar(float value, float max) is supposed to print that table like:

Time Voltage
-------------------------
0.00000 0.00000
1.00000 3.83796 *******
2.00000 7.08672 **************
3.00000 9.83673 *******************
4.00000 12.16457 ************************
5.00000 14.13504 ****************************
6.00000 15.80301 *******************************
(and so on
• 09-13-2002
jjj
and this is very rough draft, I know I need to declare variables and all. I just have trouble conceptually at times, and then putting what I understand into the code. I understand I will need a "while" loop in my main() code, merely because I saw someone do it.
• 09-13-2002
C-Dumbie
You should run a LOOP to deal with time;
Ex:
Code:

```  if (starTime > endTime)     cout>>"Invalid time range!";   While (startTime <= endTime)         {           /* call those functions to perform             calculation here*/                   startTime++;  /*increment time*/                    }```
[code tags added by ygfperson]
Hope you get an idea!
C-Dumbie
• 09-13-2002
gabulldog
Quote:

CIE Fall 2002 Homework #2
Transient Circuit Analyzer
Due Date: September 13, 2002, 5:00 pm Central Daylight Time
Nothing like getting an early start on the old homework assignment! :D
• 09-13-2002
jjj
hey, I started on Wednesday! But my knowledge is not that good so I am stuck.
• 09-13-2002
Mister C
Still as the saying goes...

Procrastination on your part does not constitute an emergency on ours..

Where are your function calls in main??
Mr. C.