Question: (With C++ program) Construct a template function named print_ doubled which takes a template type as input, and simply print out the twice of the

Construct a template function named print_doubled() which takes a template type as input, and simply print out the twice of the value. The function should support most of the numeric types, e.g. integer, floating point number, etc. If the template type is "std::string" or "const char *" (as a C-style string), simply print the string twice, e.g. print_doubled (42); print doubled (19937L); print_doubled (3.14F); print_doubled (2.71828); print_doubled (1.0545718E-34L); print doubled ("banana"); std::string str - "orange"; print_doubled (str); The above code should print ths following on the screen: 84 39874 6.28 5.43656 2.109140-34 bananabanana orangeorange Language Mode C/C++ Your Code XL LMS RESET 1 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
