// // Example of how to use template // // Week 2, lecture 2.1 // #include using namespace std; #include //-=-=-=-=-=-=-=-=-=-=- // // Ideas // ----- // data is not mutable, usa a const // s with default 0 // // I can call this function with: // // sum(scores, 92) // sum(scores, 92,58) -> In this case s starts with 58 // // You could use a default falue for size variable // //-=-=-=-=-=-=-=-=-=-=- template T sum(T data[], int size, T s = 0) { for (int i = 0; i < size; ++i) s+= data[i]; // += must work for T return s; } template T display(T data[], int size) { for (int i = 0; i