Function Templates

Hi, I need some help with function templates - specifically implementing the complex and date classes into the code.. Here is the assignment:

Write a simple function template for predicate function isEqualTo that compares its two arguments of the same type with the equality operator (==) and returns true if they are equal and false if they are not equal. Use this function template in a program that calls isEqualTo on a variety of built-in types and user define types, Complex and Date (need to overload the equality operator (operator==) and extraction operator (operator<<)). Write a program with variety of inputs to test the functionalities of the program.

The following are classes, functions, and private data members needed in this program. You can add and create more classes, functions and private data members for this program.

Date class
There should have three private integer data members, month, day and year for the Date class.
It should have Date, operator<< and operator== functions in the class. The Date class has to do a validation on data.

Complex class
There should have two private double data members, real and imaginary for the Complex class.
It should have Complex, operator<< and operator== functions in the class.

CISP400V9A6.cpp
Implement an isEqualTo template function to test with different types.
The data type and data are list as follow:

Data type Operant 1 Operant 2
Int 1 1
Int 2 4
Int -1 1
Int -1 -1
char a a
char a c
char c a
char c c
double 2.2 2.2
double 2.2 2.3
double -2.2 2.2
double -2.2 -2.2
Complex (10, 5) (10, 5)
Complex (10, 5) (10, 54)
Complex (10,- 5) (10, 5)
Complex (-10, -5) (-10, -5)
string abcdefg Abcdefg
string abcdefg Abcdefh
String -abcdefg Abcdefg
string -abcdefg -abcdefg
Date (2, 31, 2017) (2, 31, 2017)
Date (2, 13, 2017) (2, 14, 2017)
Date (-2, 13, 2017) (2, 13, 2017)
Date (-2, 13, 2017) (-2, 13, 2017)


I've done the ints, chars, doubles and string, but I need to use a class for date and for the complex numbers and I'm just having a hard time with that. Any insight will help, thank you!!
You can use the Complex class
http://www.cplusplus.com/reference/complex/complex/

A Date class is not available so you have to write your own.
Topic archived. No new replies allowed.