ECE 1620 - Assignment #3 - Due: 4 Feb 2022


General requirements


  1. a3/p1.c - Modify chapter2_4.c

    Start with a copy of program chapter2_4.c shown on pages 69-70 which computes velocity and acceleration values. Use the Copy button at bottom of VECR, then rmcmts to remove the original comments.

    1. Compile and run to make sure it works to start with.

      Enter the input value (50) in the args: input area and use the Input button to run it:

      Compile args:

    2. Insert a statement to display the time value before printing the other outputs.

    3. Eliminate the use of pow() in the velocity computation and replace with nested-form multiplication to minimize the number of multiplications.

    4. Write a function to compute the velocity and move the velocity computation formula from the main program into your function.

      Then change the main program to use your function. For example, if your function was named vpoly:

          velocity = vpoly( time);
        
    5. Write a function to compute the acceleration and move the acceleration computation formula from the main program into your function.

      Then change the main program to use your function. For example, if your function was named apoly:

          acceleration = apoly( velocity);
        

  2. a3/p2.c - Sine and cosine

    Write a function to convert an angle from degrees to radians (180 degrees = π radians).

    Then write a main program which uses scanf() to read an input angle in degrees (d) and uses your function to convert to radians (r).

    The output must include:


  3. a3/p3.c - π questions

    Is eπ equal to 20+π? Or is it larger or smaller?

    Is π equal to (92+192/22)1/4? Or is it larger or smaller?

    Write a C program to compute and print the values of the quantities in the questions above so that by looking at the output of the program you can answer the questions.


  4. a3/p4.c - Modify distance_Point.c

    Start with a copy of program distance_Point.c (use the Copy button at bottom of VECR), which computes the distance between two points in 2 dimensions using a Point structure.

    1. Compile and run to make sure it works to start with.

    2. Add printf statements to the main program to display the x,y coordinates of the two points.

    3. Change the Point structure and functions to compute the distance between two points in 3 dimensions, i.e. add a z coordinate to the structure and modify the functions and main to use 3 dimensions. Initialize the z coordinates of the points to some values of your own choosing.

      Note that there are still just two points, but each point has 3 coordinates.

    Pythag Notes