0

Hi i am writing a program to calculate the area of a shape using functions. I got the program to work fine when there was only one function and one shape however when i added the second one the program will still run both functions. That is even when i type in 'R' it still wants to find the area of a circle? here is what i have so far..

```
#include <iostream>
#include <cmath>
using namespace std;
double circle(double r)
{
double A;
A=3.14159*r*r;
return(A);
}
double rectangle(double w, double h)
{
double A;
A=w*h;
return(A);
}
void main (void)
{
char c1, c2, x;
double r, A, w, l;
c1='C';
c2='R';
cout<<"Enter a shape:"<<endl;
cin>>x;
if (x = c1)
{
cout<<"Enter a radius:"<<endl;
cin>>r;
A = circle(r);
cout<<A;
}
else(x = c2)
{
cout<<"Enter a width:"<<endl;
cin>>w;
cout<<"Enter a lenght:"<<endl;
cin>>l;
A = rectangle(w, l);
cout<<A;
}
}
```

Thank you in advance for trying to help me!