What did I do wrong? Can anyone please explain to me so I can learn?

#include <iostream>
#include <string>
#include <cmath>
#include <math.h>
#include <algorithm>

using namespace std;

class Distance
{
private:
	int length;

public:
	Distance(int length = 0);
	int operator *(Distance My_Trip);
	int trip_length;
};

int Distance::operator *(Distance My_Trip)
{
	int answer__ = (length * My_Trip.trip_length);
	return answer__;
}

template <class T>
T square(T value)
{
	T Answer = (pow(value, 2));
	return T Answer;
}

Distance::Distance(int length):
     length(length)
{

}


int main()
{
	int answer_;
	int value;
	int Length_;

	cout << "What is your value number? ";
	cin >> value;
	cout << endl << endl;

	cout << "What is your length? ";
	cin >> Length_;
	cout << endl << endl;

	Distance My_Trip(Length_);
	Distance Double_Trip;

	Double_Trip = square(Length_);
	answer_ = square(value);

	cout << "Double Trip : " << Double_Trip.trip_length << endl << endl;
	cout << "Answer : " << answer_ << endl << endl;

	system("pause");
	return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.