Ex. 6.2 — Structure, pointers, and functions
You cannot submit for this problem because the homework's deadline is due.
Upload file
Using C template as before (including Makefile
/CMakeLists.txt
, Assignment.h
, main.c
and corresponding exercise C file).
Description
Write two structures to represent a point in the complex plan. In the README file explain and
argue on your choices, including data types.Write two functions to convert from Cartesian to Polar and from Polar to Cartesian. The functions should use pointers such that more than one set of coordinates can be converted at a time. That is the pointer could contain more than one complex number such that the function would returns the conversion of all the complex numbers at once.
In the main function define the following complex numbers and convert them between Cartesian
and Polar coordinates: \(3+\frac{4}{5}i\), \(\log(4)i\), \(45.245+0.235i\), \(3e^{\frac{i\pi}{17}}\), \(4(\cos\frac{\pi}{9}+i\sin\frac{\pi}{9})\), \(e^{\frac{i\pi}{12}}\)
Format
Input
None
Output
Prints the numbers by pair, one pair per line, the original number first and the converted one second, with five decimal points
Sample 1
Output (first line)
3.00000+0.80000i 3.10483e0.26060i
Limitation
1s, 32MiB for each test case.
Homework 6 (Group)
- Status
- Finished
- Problems
- 6
- Open Since
- 2019-11-04 00:00
- DDL
- 2019-11-10 23:59
- Extension
- 24.0 hour(s)