I am writing the following program to give the area of an certain chosen geometric object. The math seems fine, however when I try to run the program it goes through Line 30, gets the input for AREA, and then it hangs at a flashing cursor, I believe it has something to do with the WHILE statement, but without the while statement, it will not loop back to the top. Does anyone have a hint that I am missing?
#include <iostream>
#include <iomanip>
#include <math.h>
usingnamespace std;
int main()
{
std::cout << std::fixed;
std::cout << std::setprecision(2);
//variable declaration
int AREA;//type of area to solve for
float side;//for the square
float radius;//for the circle
float radiussquared;//squared value of the radius
float width;//for the rectangle
float length;//for the rectangle
float base;//for the triangle
float height;//for the triangle
float trianglearea;//Area of Triangle
float squarearea;//Area of square
float circlearea;//Area of circle
float rectanglearea;//Area of rectangle
int decider;//for deciding whether to run another loop
//getting variable for while loop
cout << "Please enter number for type of area to solve for (1=square, 2=circle, 3=rectangle, 4=triangle) ";
cin >> AREA;
decider = 1;
while ((decider = 1));
{
if (( AREA == 1));
{
cout << "Please input the size of one of the sides of the square ";
cin >> side;
squarearea = side * side;
cout << "the area of the square is " << squarearea;
cout << "Do you wish to figure for another Area? (1 for Yes, 2 for No) ";
cin >> decider;
if (( decider = 2 ))
{
return 0;
}
}
if ((AREA = 2));
{
cout << "Please input the radius of the circle ";
cin >> radius;
radiussquared = radius * radius;
circlearea = radiussquared * M_PI;
cout << "The area of the Circle is " << circlearea;
cout << "Do you wish to figure for another Area? (1 for Yes, 2 for No) ";
cin >> decider;
if (( decider = 2 ))
{
return 0;
}
}
if ((AREA = 3));
{
cout << "Please input the width of the rectangle ";
cin >> width;
cout << "Please input the length of the rectangle ";
cin >> length;
rectanglearea = width * length;
cout << "The Area of the Rectangle is " << rectanglearea;
cout << "Do you wish to figure for another Area? (1 for Yes, 2 for No) ";
cin >> decider;
if (( decider = 2 ))
{
return 0;
}
}
if ((AREA = 4));
{
cout << "Please input the height of the triangle ";
cin >> height;
cout << "Please input the base of the triangle ";
cin >> base;
trianglearea = (height * base) / 2;
cout << "The Area of the Triangle is " << trianglearea;
cout << "Do you wish to figure for another Area? (1 for Yes, 2 for No) ";
cin >> decider;
if (( decider = 2 ))
{
return 0;
}
}
}
return 0;
}