Answered step by step
Verified Expert Solution
Question
1 Approved Answer
build a function in C++that can compare two parameters. This function should return a negative value (the value should be meaningful if possible: otherwise just
build a function in C++that can compare two parameters. This function should return a negative value (the value should be meaningful if possible: otherwise just make sure it's negative) ifthe first parameter is smaller, 0 if they are equal, and a positive value if the first parameter is larger (the value should be meaningful if possible; otherwise make sure it's positive). This function should work with int, char, double, and string types Implement a function template to achieve the goal. After implemented the function template, test it with the following main function to make sure it will return the e int mainO ta; :eeu, return pos (prefer (prefer -32) 0.5)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started