Skip to content
/ Homework1 Public template

Second homework of ECE 231: Intermediate Programming. Assigned 1/31/2020. Due 2/7/2020, 11:59 pm.

Notifications You must be signed in to change notification settings

UNMECE231Sp2020/Homework1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Homework1

Second homework of ECE 231: Intermediate Programming. Assigned 1/31/2020. Due 2/7/2020, 11:59 pm.

Context

You are to update a library that is a simple complex library. You are going to create two functions, make an already existing function more robust, create an array of function pointers, and go through the array of function pointers, calling each function.

In my_complex.h

You are going to create two function prototypes:

A function that will not return anything and take three inputs: a function pointer that returns a complex struct, and two complex structs, that represent the inputs for the function pointer. 
A function that will not return anything and take two inputs: a function pointer that returns a double and has a complex struct input, and another input that is the double to be the argument in the function pointer. 

In complex_fns.c

You are going to be:

Modifying complex_div so that there is no division by zero 
Create a function handler that takes a pointer to a function and two complex structs as an input. It should call the function. Should handle the add, sub, mult, and div functions. Should print result of function called.
Another function handler but handles magnitude and phase functions only. Should print result of function called.

In main.c

There are two complex numbers that are given to you, you must:

Create an array of function pointers that holds: add, sub, mult, and div
Create another array of function pointer that holds: magnitude and phase
Two loops that go through each array and call each function with the two complex numbers given to you

Feel free to create more complex numbers and test them with your function handler. Also feel free to call your function handler directly.

Rubric

  1. Function prototypes: 20%
  2. Function implementation: 40%
  3. Pointer array creation and use: 20%
  4. Clean code: 20%

About

Second homework of ECE 231: Intermediate Programming. Assigned 1/31/2020. Due 2/7/2020, 11:59 pm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published