Thread: homework giving difficulty

  1. #1

    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.

    here is my code anyways. the last function is supposed to print out a table, max of 50 stars(b/c voltage max);
    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

  2. #2
    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.

  3. #3
    You should run a LOOP to deal with time;
      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!

  4. #4
    Registered User
    Join Date
    Jul 2002
    From homework link:
    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!

  5. #5


    hey, I started on Wednesday! But my knowledge is not that good so I am stuck.

  6. #6
    CS Author and Instructor
    Join Date
    Sep 2002
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Homework
    By kermi3 in forum A Brief History of
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM
  2. Homework
    By kermi3 in forum C Programming
    Replies: 10
    Last Post: 09-27-2001, 04:49 PM
  3. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 03:16 PM
  4. Homework
    By kermi3 in forum Windows Programming
    Replies: 5
    Last Post: 09-15-2001, 11:48 AM