vector template help

This is my first post on the forum, although I've been coming here to find search for help for some time now. I'm taking a C++ programming class, and am having trouble with my most recent assignment. I'm not here for straight-up answers, just a little help.

I was supposed to write a program that takes in some elements to put into a vector, and then sorts them from greatest to least. After some time, I came up with this code, which I think works fine:

The main cause of problems is one of types on lines 14 and 15 in main().

A template type is an incomplete type. It cannot be instantiated into an actual variable type without further information: the template arguments.

Hence, you cannot declare a variable as vector <T> v; , since T is not a valid type. You must decide what type you wish to use. Since you are reading ints from the user (as per line 19) you might as well have a vector of them. Get rid of line 14 and change line 15 to read vector <int> v; If you try compiling again you'll notice that your list of errors has shortened considerably. :)

Next, line 57 (swapValues()) does not declare a template function. So two things are wrong with it: 1) it does not satisfy the prototype on lines 9 and 10, and 2) the compiler will barf on the unknown type T. Fix it by adding the line template <class T> in front of the swapValues() definition.

There is one other thing you need to notice. Line 46 assumes that T is an alias for int when you declare your indexOfMax variable. That's bad. What if it were string? or bool? Change it to T max = v[startIndex];int indexOfMax = startIndex; Hmm, I think that's it. I hope I got the line numbering right...
Have fun!