Question: In c++ Code provided #include #include using namespace std; // Write the timesTwo function template here. // // // // // // int main() {
#include #include using namespace std; // Write the timesTwo function template here. // // // // // // int main() { double prices[5] = { 150.00, 200.00, 345.00, 999.99, 44.00}; string animal[5] = { "Dog", "Cat", "Wolf", "Lion", "Fox" }; timesTwo(prices, 5); timesTwo(animal, 5); return 0; };
The following short main function for Question 2 is provided on Canvas int main() double prices[5]150.ee, 200.00, 345.00, 999.99, 44.0); string animal[5] { -Dog", "Cat", "Wolf", "Lion", "Fox" }; = timesTwo(prices, 5); timesTwo(animal, 5) return e; )i Notice that the first timesTwo function call passes an array of type double and the size of the array. The second timesTwo function call passes an array of type string and the size of the array Instead of writing two functions, write a function template, so the same single timesTwo function can process and print both types. The string output will be concatenated with itself, and the double output will be each value plus itself Sample Output: Select CAUsers jlatel Source Repos Lab14.q2 DebuglLab14.q2exe 300 90 1999.98 Dog atCat lfWolf ionLion oxFox
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
