126 Introduction to C++ Programming and Graphics
int i=5, j=10;
prsum<int,1>(i,j);
float a=4.5, b=-30.4;
prsum<float, 2>(a,b);
string s="amphi", t="theater";
prsum<string, 3>(s,t);
return 0;
}
Running the code produces on the screen:
115
2 -25.9
3 amphitheater
Problems
4.10.1. Write a function template of your choice.
4.10.2. Convert the selection-sort algorithm discussed in Section 3.8 into a
template, and then run it for (a) a list of real numbers, and (b) a list of
strings.