0

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;
}
2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by rebellion346
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.