I am writing a program for a class that I am taking and when trying to define the constant 'pi' I am getting error C2062: type 'double' unexpected. Below, I have attached my code. I am completely open to suggestions as I am a beginner at this. Thank you in advance for your help!
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int choice,
//error C2602: type 'double' unexpected
const double pi = 3.14159 ;
{ case 1 : cout << " Please enter the radius of the circle and press <ENTER> : " ;
cin >> radius ;
circ_area = pi * radius * radius ;
cout << " The area of the circle is " << circ_area << ". " << endl ;
break ;
case 2 : cout << " Please enter the length of the rectangle and press <ENTER> : " ;
cin >> length ;
cout << " Now enter the width of the rectangle and press <ENTER> : " ;
cin >> width ;
rect_area = length * width ;
cout << " The area of the rectangle is " << rect_area << ". " << endl ;
break ;
case 3 : cout << " Please enter the length of the triangle's base and press <ENTER> : " ;
cin >> base ;
cout << " Now enter the height of the triangle and press <ENTER> : " ;
cin >> height ;
tri_area = base * height / 2 ;
cout << " The area of the triangle is " << tri_area << ". " << endl ;
break ;
}
if (choice < 1 || choice > 4)
cout << " You did not enter a valid menu selection. " << endl ;