Skip to content
System Programming
ENV-2: Complex numbers and sorting

ENV-2: Complex numbers and sorting

Requirements

Write multi-file C++ program consisting of following 3 modules:

  • A class that represents a complex number along with all the basic operations: plus, minus, multiply by a constant, absolute value.
  • A function that implements any sorting algorithm on an array/vector of complex numbers.
  • A main function containing a demonstration of having multiple complex numbers in array and sorting them.

Modules for complex number class and sorting algorithm should be separate and each of them should have source and header files.

Expected result

A solution containing all the described modules (source and header files), as well as, a Makefile for automated build of the solution.

The final solution should contain a Makefile for the multi-stage build. The Makefile should also contain targets all and clean. It’s recommended to have compiler and compiler flags to be declared as a Makefile variables. Alternatively, cmake could also be used instead of make.