Looks good to me.
Has your book mentioned checking for or handling input errors? If the user types a character instead of a number you'll have problems.
One solution is to use a while loop to get input and keep asking until they input a valid number:
Code:
while (!(std::cin >> Temp))
{
// clear the fail bit
std::cin.clear();
// empty any and all bad characters from stream
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
// give error message and new prompt here:
std::cout << "Invalid element, try again: ";
}
You'll need to #include <limits> for numeric_limits and <ios> (I think) for streamsize.