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

(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 value. The function should support most of the numeric types, e.g. integer,
floating point number, etc.
 (With C++ program) Construct a template function named print_ doubled which
takes a template type as input, and simply print out the twice

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 2 #include 4 /// START YOUR FUNCTION IMPLEMENTATION HERE /// 5 3 6 11 UN 7 /11/ END YOUR FUNCTION IMPLEMENTATION HERE III 8 9 int main() 10+ print_doubled(42), 12 print doubled (19937L); 13 print doubled(3.14F); 14 print_doubled(2.71828); print doubled (1.0545718E-34L); 16 print doubled("banana"); 17 std::string str = "orange"; 18 print_doubled(str); 19 20 return 0; 21 } 22 15 Ooo NNN

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!