Can you please help me and tell me what I am doing wrong? I have been looking at the program for two hours and need help. I keep getting this error: 'triangle' was not declared in this scope. Also, that is the only error, so I don't have anymore. Thank you.
#include <iostream>
using namespace std;
int main()
{
typedef unsigned short USHORT;
int shape;
cout << "What shape do you want: ";
cin >> shape;
USHORT shape1 = triangle, square, rectangle, circle;
if (shape = triangle)
{
int triangle;
cout << "What is the height: ";
cin >> triangle;
int triangle1;
cout << "What is the length of the base: ";
cin >> triangle1;
int side;
cout << "What is the length of side 1: ";
cin >> side;
int side1;
cout << "What is the length of side 2: ";
cin >> side1;
int side2;
cout << "What is the length of side 3: ";
cin >> side2;
USHORT base = triangle1, height;
height = triangle;
USHORT bug1 = side, bug2;
bug2 = side1;
USHORT bug3 = side2;
USHORT area = 1/2 * base * height;
USHORT perimeter = bug1 + bug2 + bug3;
cout << "\nArea: " << area << "\n";
cout << "Perimeter: " << perimeter << "\n";
return 0;
}
if (shape = square)
{
int sides;
cout << "What is the length of the sides: ";
cin >> sides;
USHORT width = sides, length;
length = sides;
USHORT area = width * length;
USHORT perimeter = width * 4;
cout << "\nArea: " << area << "\n";
cout << "Perimeter: " << perimeter << "\n";
return 0;
}
if (shape = rectangle)
{
int number;
cout << "What is the width: ";
cin >> number;
int number1;
cout << "What is the length: ";
cin >> number1;
USHORT width = number, length;
length = number1;
USHORT area = width * length;
USHORT perimeter = (width * 2) + (length * 2);
cout << "\nArea: " << area << "\n";
cout << "Perimeter: " << perimeter << "\n";
return 0;
}
if (shape = circle)
{
int radius;
cout << "What is the radius: ";
cin >> radius;
USHORT half = radius;
USHORT area = (3.14 * half) * (3.14 * half);
USHORT circumfrence = 2 * 3.14 * half;
USHORT volume = (4/3 * 3.14 * half) * (4/3 * 3.14 * half) * (4/3 * 3.14 * half);
cout << "\nArea: " << area << "\n";
cout << "Circumfrence: " << circumfrence << "\n";
return 0;
}
else
cout << "Shape not available.";
return 0;
}