Write a generic function that calculates and returns the absolute value of two numeric values (of the same type) passed
Posted: Thu May 05, 2022 2:00 pm
Write a generic function that calculates and returns the absolute value of two numeric values (of the same type) passed in (x-yl). The function should operate with any numeric data types (e.g. float, int, double). #include <iostream> using namespace std; // ----- ENTER YOUR CODE HERE ---- int main() { // Variable declarations int i1, 12; double d1, d2; i1 = 10; i2=20; cout << "Absolute value of 10,20 is " << absoluteValue(i1,i2) << endl; d1 = 5.5; d2=3.1; cout << "Absolute value of 5.5, 3.1 is " << absoluteValue(d1,d2) << endl; return 0; }