101
{ USER }
posts: 55
last: 09-Apr-2008
TITLE: If - Else example
DESCRIPTION: If - Else example
Submitted: 09-Apr-2008 08:08:51 ( 38w 5d 22h ago ) Language: C++ (*.cpp *.h)
Views: 91 Lines of Code: 24 LINES
Rating:
rate: star1
star2
star3
star4
star5
dstar1
dstar2
dstar3
dstar4
dstar5  ( rated! )
  { 0.00 / 5 }
Difficulty: Intermediate
Bookmark
/* Author: 101
   Date: 09-04-2008
   Filename: 
   Description: If - Else example
   History: 
*/


#include <iostream.h>
#include <math.h> 
int main()
{
double radius;
//get user input
cout<<"Please enter the radius : ";
cin>>radius;
//act on user input
if(radius < 0.0)
cout<<"Cannot have a negative radius"<<endl;
else
cout<<"The area of the circle is "<<3.1416 * pow(radius,2)<<endl;

return 0;
}