Area and Circumference of a Circle

Published on: June 30, 2010

This is another video of my Easy Programming series. Here I show you how to write a simple Console application program using C++ (Microsoft Visual Studio 2008) where you can find the Area and Circumference of a circle with ease. This is just a video to help beginners practice and get used to the feeling of C++ and the basic codes that you may need to advance. As I said before, I'm still learning and I am in no way an expert but I use this time to help teach you and others what I've learned so far. If you want the code itself, leave a message here and I'll send you the code right away.

Remember to checkout the Codesnip below to review the C++ code yourself! Feel free to copy the code, but I ask that you please provide credit if you leave the code unchanged when you use it.

Codesnip:

//Progammer: Nazmus
//Program:  Area and Circumference of a Circle
//Purpose:  Easy Programming Video
//Website:  EasyProgramming.net

#include<iostream>
using namespace std;

void main()

{
 double pi, radius, area, circumference, diameter;

 pi = 3.141592653589793238462643383279502884197169399375;

 cout << "Please input the value of the diameter: ";
 cin >> diameter;

 radius = diameter/2.;
 area = pi * (radius*radius);
 circumference = 2 * pi * radius;

 cout << "The area of the circle is " << area << " and the circumference is " 
  << circumference << '.' << endl;

 system("pause");
}



Comments: