My "if" statement displays but my "else" statement does not. Any ideas how I can fix this? (this is my only error)
#include <iostream>
#include <string>
using namespace std;
int main()
{
int sum_angle;
int num_sides;
int r_d; // radians/degrees
char R; //input radians
float radian;
cout << "Basic Geometry with c++";
cout << "\n-----------------------\n";
cout << "Enter the number of sides of your polygon (3-10) :\n";
cin >> num_sides;
cout << "display options:\n";
cout << " - Type R for radians\n";
cout << " - Type anything else for degrees\n";
cin >> R;
sum_angle=(((num_sides)-2)*180);
radian=(sum_angle*(3.14/180));
if (R)
{
cout << "The sum of interior angles in your polygon is:" << radian << "radians";
cout << "\nA polygon with " << num_sides << " sides is called a ";
}
else
{
sum_angle=(((num_sides)-2)*180);
cout << "The sum of interior angles is:"<< sum_angle;
cout << "\nA polygon with " << num_sides << " sides is called a ";
}
if (num_sides==3)
cout << "triangle";
if (num_sides==4)
cout << "quadrilateral or tetragon";
Thank you so much it works now. I didn't expect such a quick response. I am very impressed and glad that I just became a member of this forum. Thanks again.