ofstream output ("E:result.dat");
output<<"the perimeter of the shape is"<<per<<endl;
cout<<"the area of the shape is"<<area_51<<endl;
output<<"the area of the shape is"<<area_51<<endl;
cout<<"the perimeter of the shape is"<<per<<endl;
output<<"the perimeter of the shape is"<<per<<endl;
cout<<"the area of the shape is"<<area_51<<endl;
output<<"the area of the shape is"<<area_51<<endl;
system ("pause");
return 0;
This part specifically: (h*a)(a*j) You are missing an operator between the two.
should it be (h*a) + (a*j) or (h*a) * (a*j)
Third Problem:
"per" is never initialized. And the first thing you do is - output<<"the perimeter of the shape is"<<per<<endl; per has no value, it is garbage. You calculate per after that. Wouldnt you first want to calculate per, and then put it in the file?