if (ashape = Triangle)
{
Area = .5 * d1 * d2;
return Area;
}
else if (ashape = Circle)
{
Area = 3.14 * d2 * d2;
return Area;
}
else if (ashape = Rectangle)
{
Area = d2 * d3;
return Area;
}
else if (ashape = Square)
Two equals signs are needed to test for equality. One equals is the assignment operator, so you're setting the values each time, and (if I am not mistaken) the if statement will always return true in that case.
Also you're comparing a char to a variable of type 'Shapes'. Is that a char as well? If not, I don't think it will work.
char ashape;
if (ashape == Triangle)
Also, about the indenting, what I took it to mean was that you have some unnecessary indenting, although indenting is the right thing to do. Oddly enough, that was one of the hardest things for me to get right, when I started programming.
}
ofstream outfile ("PJ657_output.txt"); // why indent this?
if (!outfile)
{ // why indent this?
Maybe something like this would be better/more readable?
} ofstream outfile ("PJ657_output.txt");
if (!outfile) {