How to write a Program Finding Area of Circle in C++

Vu Old Solved Programming Based Assignments Codes are Available in this Section.
Post Reply
User avatar
ALI RAZA
★★★★★★★★★★★★★
★★★★★★★★★★★★★
Posts: 177
Joined: Fri Dec 22, 2017 8:10 am
Location: Lahore
Has thanked: 6 times
Been thanked: 7 times
Contact:
Status: Offline

How to write a Program Finding Area of Circle in C++

Post by ALI RAZA » Fri Aug 31, 2018 10:42 am

This Code By Ali Raza Tawry Calculates Area of Circle By Functions Use in C++ Copy code or Download exe file from Attachment .Help Full in CS201

Code: Select all

//This Program is used to calculate the Area of The circle and the Circumferenc of the
//circle by using the Class mechanism

#include<iostream.h>

//Defining A macro in the program
#define pi 3.14159



//Defining The class in program
class circle
{ public: 
          //Veriable declearation for redious
          double redious;
          //Defining Default constructor
          circle();
          //Defining display function to display default values in The programe
          void display();
          //This function is use to prompt the user to get redious
          double getredious();
          //This function calculate The area of the circle
          double CalculateArea(); 
           //This function calculate circumferenc of the circle
          double CalculateCircum();
private:
        //veriables for Area and circumferenc use in constructor as default values
          double area,crcumsts;
     
};
 
 
 
 
 
 //Seting Default values by defination
 circle::circle(){
                 redious=0;
                 area=0;
                 crcumsts=0;
                 }
 //Defination of the Display function for displaying default values
void circle::display(){
                      cout<<"The redious is of the circle is ="<<redious<<endl;  
                      cout<<"The area of the circle is given ="<<area<<endl;
                      cout<<"The circumference of the circle ="<<crcumsts;
                      }
//Defination of the function for prompt the user to enter the redious
double circle::getredious(){
       cout<<endl;
       cout<<endl;
       cout<<"The redious of circle = ";
       cin>>redious;
       }
//Defination of the function for Area calculation
double circle::CalculateArea(){
       cout<<endl;

       cout<<"The area of the circle ="<<(pi*redious*redious);
       }
//Defination of the function for calculate circumference of the circle
double circle::CalculateCircum(){
       cout<<endl;
       cout<<"The circumfrenc circle ="<<(2*pi*redious);
       cout<<endl;
       cout<<endl;
       cout<<endl;
       cout<<endl;
       }






//main function strting body of the programing
main()
{   //Heading the programe to look better and good visiual
    cout<<endl;cout<<"\t"<<"Calculate Area of Circule www.vusociety.com"<<endl;
      cout<<"       ***********************************";
      cout<<endl;
      cout<<endl;
      cout<<endl; 

     
     
     //Creating an Object of the class circle
       circle mycircle;
     // Funtion call to display default valuse
       mycircle.display();
     //funtion call to propmting user to Enter the redious value
       mycircle.getredious();
     // function call for area Reslut
       mycircle.CalculateArea() ;
     //function call for circumferenc result
       mycircle.CalculateCircum();
       cout<<endl;
       cout<<endl;
       system("pause");
       
   
}



Post Reply

Last 10 Members Who Visited This Topic

  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest