Write a template-based function that takes an array of any data type and print the frequency of each data item in this array. Write main to call this function on an "int" and a "float" array.
Make a class Rational to maintain rational numbers. These numbers are in the form p/q (fractions). Keep all member variables private. Write the following member functions in this class:
e.g.
main()
{
Rational rat1, rat2;
rat1.ChangeNumerator(2);
rat1.ChangeDenominator(5);
rat2.ChangeNumerator(1);
rat2.ChangeDenominator(10);
rat1.Add(rat2);
rat1.Print();
}
The above program should produce the output:
1/2