You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This exercise involves implementing three function templates: swap (swaps the values of two given parameters, returning nothing), min (compares two values and returns the smallest one; if equal, returns the second), and max (compares two values and returns the greatest one; if equal, returns the second). These functions must be able to be called with any type of argument, provided the two arguments have the same type and support all necessary comparison operators. Templates must be defined in the header files.
This exercise involves implementing a templated Array class that behaves like a dynamic array, supporting constructors (empty and with unsigned int parameter), copy operations (copy constructor and assignment operator with deep copy semantics), element access through the subscript operator ([]) with bounds checking (throwing std::exception if out of bounds), and a size() member function that returns the number of elements. Memory must be allocated using new[].
General Rules
Code is compiled with c++ and flags -Wall -Wextra -Werror.
Code must compile with the -std=c++98 flag.
Class names are in UpperCamelCase.
Output messages end with a newline character.
The C++ standard library is allowed, but external libraries and certain C functions (printf(), *alloc(), free()) are forbidden.
using namespace <ns_name> and friend keywords are forbidden unless explicitly stated.
STL (containers, algorithms) is forbidden in this module.