WHy wont the following work??
Code:
#include <iostream.h>
#include <conio.h>

int main()
{
double radius;
const double pi=3.14;
char calc;
cout<<"This program can calculate Surface area and Volume for a sphere. Type in V for Volume calculation or S for Surface area."<<endl;
cin>>calc;
if(calc=="V")
{
cout<<"What is the radius of the sphere?"<<endl;
cin>>radius;
cout<<"The Volume of the sphere is: "<<(4*pi*(radius*radius)/3)<<endl;
}
if(calc=="v")
{
cout<<"What is the radius of the sphere?"<<endl;
cin>>radius;
cout<<"The Volume of the sphere is: "<<(4*pi*(radius*radius*radius)/3)<<endl;
}
if(calc=="S")
{
cout<<"What is the radius of the sphere?"<<endl;
cin>>radius;
cout<<"The Surface area of the sphere is: "<<(4*pi*(radius*radius))<<endl;
}
if(calc=="s")
{
cout<<"What is the radius of the sphere?"<<endl;
cin>>radius;
cout<<"The Surface area of the sphere is: "<<(4*pi*(radius*radius))<<endl;
}
getch();
getch();
return 0;
}
Id appreciate the help