[Advanced
C++ Topics]

The number of your particular task is the value of the
expression
`faculty_number%14`.

0. Define a class Deque
that represents a deque of strings by keeping its elements in a
dynamically allocated array (maximum capacity) and make the deque as a
"circular array" (the first element follows the last one).

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Deque s;

Deque t = s;

and assignment

Deque s;

Deque t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member function size,
push_front and push_back. Overload the -- unary prefix operator (--d) for pop_front operation
and -- postfix operator (d--) for pop_back operation.
Overload the stream operators <<
and >> for output
and input deque elements. Demonstrate all these functions and
operators.

1. Define a class Queue that
represents a queue of strings by keeping its elements in a dynamically
allocated array (maximum capacity) and make the queue as a "circular
array" (the first element follows the last one).

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Queue s;

Queue t = s;

and assignment

Queue s;

Queue t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member function size().
Overload the += binary
operator for push an element to a queue and the -- unary operator for pop an
element from the queue. For example

Queue q;

q += "abc";

q--;

produces an empty queue. Overload the stream operators << and >> for output and input
queue elements. Demonstrate all these functions and operators.

2. Define a class Stack
that represents a stack of strings by keeping its elements in a
dynamically allocated array (maximum capacity).

Supply the "big three" memory management functions. Use this
class to demonstrate

(a) the difference between initialization

Stack s;

Stack t = s;

and assignment

Stack s;

Stack t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply member functions push
and pop that add and
remove an element to and from a stack. Overload the + operator for joint two stacks
with return value a new stack, produced by repeatedly removing an
element from the second stack and add it to the first stack. Overload
the stream operators <<
and >>. Demonstrate
all these functions and operators.

3. Define a class Rectangle
with sides, parallel to the coordinate axes. A rectangle is defined by
two points in the plane - upper-left and lower-right corners. Store the
data members in a dynamically allocated array of integers.

Supply the "big three" memory management functions. Use this
class to demonstrate

(a) the difference between initialization

Rectangle s;

Rectangle t = s;

and assignment

Rectangle s;

Rectangle t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply member functions that calculate the perimeter and the area of
the rectangle. Overload the &&
operator that return the intersection of two rectangles and the > and < operators (with boolean
return values) to compare two rectangles with respect to their areas.
Overload the stream operators <<
and >>. Demonstrate
all these functions and operators.

4. Define a class Triangle
that stores the side lengths of a triangle, by keeping the numbers in a
dynamically allocated array of doubles.

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Triangle s;

Triangle t = s;

and assignment

Triangle s;

Triangle t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member functions that calcullate the perimeter and the area of
the triangle.
Overload the ++ operator
(prefix and postfix forms) that add 1 to the length of the each
triangle side and the >
operator (with boolean return value) to compare two triangles with
respect to their areas. Overload the stream operators << and >>. Demonstrate all these
functions and operators.

5. Define a class Cubic
that stores the coeficients of a polynomial of degree 3 in a
dynamically allocated array of doubles. Supply the "big three" memory
management functions. Use this class to demonstrate

(a) the difference between initialization

Cubic s;

Cubic t = s;

and assignment

Cubic s;

Cubic t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference
(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member function which calculates the value of the polynomial
for a given argument value. Overload + and - operators for addition and
subtraction of two polynomials and the unary operator * which return true or false when the corresponding
cubic function has or has not critical points. (We say that a function f(x)
has a critical point z when
its derivative has value null at this point, i.e. f '(z) = 0.) Overload the stream
operators << and >>. Demonstrate all these
functions and operators.

6. Define a class Quadrtic
that stores the coeficients of a quadratic polynomial in a dynamically
allocated array of doubles. Supply the "big three" memory management
functions. Use this class to demonstrate

(a) the difference between initialization

Quadrtic s;

Quadrtic t = s;

and assignment

Quadrtic s;

Quadrtic t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member function which calculates the value of a quadratic
function for a given argument value. Overload + and - operators for addition and
subtraction of two polynomials and the unary operator * which return true or false
when the corresponding quadratic equation has or has not real roots.
Overload the stream operators <<
and >>. Demonstrate
all these functions and operators.

7. Define a class Polynomial that
stores the coeficients of a polynomial of n-th degree in a dynamically
allocated array of integers.

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Polynomial s;

Polynomial t = s;

and assignment

Polynomial s;

Polynomial t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoced when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member function which calculates the value of a polynomial for
a given argument value. Overload +
and - operators for
addition and subtraction of two polynomials (with degrees m and n, and generaly m not equal to n) and * for multiplying a polynomial
with a real number. Overload the stream operators << and >>. Demonstrate all these
functions and operators.

8. Define a class Vector
that stores n-dimensional
vector, by keeping its elements in a dynamically allocated array of
integers. Supply the "big three" memory management functions. Use this
class to demonstrate

(a) the difference between initialization

Vector s;

Vector t = s;

and assignment

Vector s;

Vector t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoced when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a friend function which calculates the linear dependence and
independence of two vectrs (bool
return value). Overload +
and - operators for
addition and subtraction of two vectors and * for multiplying a vector with
a real number. Overload the stream operators << and >>. Demonstrate all these
functions and operators.

9. Define a class Matrix2
that stores two dimensional matrix, by keeping its elements in a
dynamically allocated array of integers (int **a;).

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Matrix2 s;

Matrix2 t = s;

and assignment

Matrix2 s;

Matrix2 t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a member function which calculates the rank of the matrix.
Overload + operator for
addition of two matrices, *
for multiplying a matrix with a real number and the unary ~ operator for calculating the
inverse matrix. Overload the stream operators << and >>. Demonstrate all these
functions and operators.

10. Define a class Biginteger
that stores arbitrary large integers, by keeping thier digits in a
dynamically allocated array of integers.

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Biginteger s;

Biginteger t = s;

and assignment

Biginteger s;

Biginteger t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply a constructor Bigintegers(string)
that reads a sequence of digits from a string. Overload + and - operators to add and subtract
the digit sequences. Overload the stream operators << and >>. Demonstrate all these
functions and operators.

11. Define a class Date
that stores day, month and year in a dynamically allocated array of
integers.

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Date s;

Date t = s;

and assignment

Date s;

Date t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply get and set member funcions for day,
month and year. Overload ++
and -- operators (prefix
and postfix forms) to set a new date - a day afrer or before the
argument (current) value, and the stream operators << and >>.
Demonstrate all these functions and operators.

12. Define a class Set that
stores integers in a dynamically allocated array of integers. In a set,
the order of elements does not matter, and every element can occur at
most once.

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Set s;

Set t = s;

and assignment

Set s;

Set t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply the add and remove member functions to add
and remove set elements; size and
contains member functions.
Overload the | and & operators to compute the
union and the intersection of sets and the stream operators << and >>. Demonstrate all these
functions and operators.

13. Define a class Multiset
that stores integers in a dynamically allocated array of integers. In a
multiset, the order of elements does not matter, and elements can occur
many times.

Supply the "big three" memory management functions. Use this class to
demonstrate

(a) the difference between initialization

Multiset a;

Multiset b = a;

and assignment

Multiset s;

Multiset t;

s = t;

(b) the fact that all constructed objects are automatically destroyed

(c) the fact that the copy constructor is invoked if an object is
passed by value to a function

(d) the fact that the copy constructor is not invoked when a parameter
is passed by reference

(e) the fact that the copy constructor is used to copy a return value
to the caller.

Supply the add and remove member functions to add and remove set
elements; int size(), bool contains(int f) and int count(int f) member
functions. The fast function counts appearances of the number f in the multiset. Overload the
++ operator (prefix and
postfix forms) for doubling all elements, which contain only once. Also
overload -- operator
(prefix and postfix forms) in such a way that the set (a++)-- is the same as a. Overload
the stream operators <<
and >>. Demonstrate
all these functions and operators.