Im getting an error that says unresolved external and i have no idea what to do, does anybody have any ideas? by the way im not sure if my code actually does what its suppose to do, its still in the works

#include <iostream>
using namespace std;

class Measure
{
	private:
		int feet;
		int inches;

	public:
		Measure() : feet(0), inches(0) { }
		Measure (int f, int i) : feet(f), inches(i) { }
		Measure convert(int s);
		Measure area(Measure M2);
		
		friend Measure read();
		friend ostream& operator<<(ostream& out, Measure& m);
};

int main()
{
	Measure M1 = read();
	Measure M2 = read();

	Measure M3 = M1.area(M2);

	return 0;
}

Measure Measure::area(Measure M2)
{	
	int a1 = inches + (feet * 12); 
	int a2 = M2.inches + (M2.feet * 12);
	int a3 = a1 * a2;

	return convert(a3);
}

Measure Measure::convert(int s)
{
	Measure temp;

	temp.inches = s / 144;
	temp.feet = s %= 144;

	return temp;
} 

Measure read()
{
	int feet;
	int inches;

	cout << "Enter the length's feet: ";
		cin >> feet;

	cout << "Enter the length's inches: ";
		cin >> inches;

	return Measure(feet, inches);
}

ostream& operator<<(ostream& out, Measure& m)
{
	out << m.feet << " x " << m.inches << endl;

	return out;
}

Recommended Answers

All 2 Replies

It compiles and runs fine for me. What's the exact error?

I got it fixed now, changed the code up a bit and it works great now, but thank you for taking the time to help :D

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.