TestingDocs.com
    Software Testing website
    • Automation
      • Selenium
      • JBehave Framework
    • Tutorials
      • MySQL Tutorials
      • Testlink
      • Maven
      • Git
    • IDEs
      • IntelliJ IDEA
      • Eclipse
    • Flowcharts
      • Flowgorithm
      • Raptor
    • About

    C++

    C++ Program to Compute Circumference of a Circle

    Overview

    In this tutorial, we will write a sample C++ program to compute the Area & Circumference of a Circle. We will use Code::Blocks IDE on the Windows platform.

    C++ Code

    In this example, we will take the user input for the circle radius, the program computes the area and circumference of the circle, displays the output to the console screen.

     

    //Compute area and circumference of circle
    #include<iostream>
    using namespace std;
    const double PI=3.1415;
    
    int main()
    {
     double radius=0.0;
     cout << "Enter circle radius :";
     cin >> radius;
     double area= PI*radius*radius;
     double circumference= 2*PI*radius;
     cout << "Area of circle =: " << area << endl;
     cout << "Circumference of circle =: "
     << circumference << endl;
     return 0;
    }

    Sample output

    Run the program and enter sample input. Verify the output of the program.

    Enter circle radius :5.0
    Area of circle =: 78.5375
    Circumference of circle =: 31.415

    Screenshot

    c++ input

    That’s it.

    —

    The IDE used in the program is Code:: Blocks. To download and install Code Blocks follow the link:
    https://www.testingdocs.com/download-and-install-codeblocks/

    For more information on Code Blocks IDE, visit the official website of Code blocks IDE:
    http://www.codeblocks.org/

     

    Related Posts

    g not found OpenSuse

    C++ /

    Install GCC C++ Compiler on OpenSuse

    sum of digits c program

    C++ /

    Sum of Digits of a Number C++ Program

    C++ Hello World Program

    C++ /

    C++ Hello World Program

    C++ /

    Object-Oriented Programming Language Examples

    C++ /

    Object-Oriented Programming Features

    ‹ C++ Output Statement› C++ Variable Declaration

    Recent Posts

    • ChatGPT Plans Free and PlusChatGPT Subscription Plans
    • Stellar Converter for Database ToolStellar Converter for Database
    • Stellar MySQL Log AnalyzerStellar Log Analyzer for MySQL
    • Stellar Repair for MySQLStellar Repair for MySQL
    • ChatGPT IntroductionChatGPT Capabilities
    • How to secure your SQL Database: Tips and Tricks
    • ChatGPT4 Conversational AI FeaturesChatGPT4 Conversational AI Features
    • Trends in Software EngineeringShaping the Future of Development: Exploring Key Trends in Software Engineering
    • Java PerformanceImproving Java Performance with Multithreading
    • QDrant Vector DatabaseOpen-source Vector Databases
    • Difference between PHP and JavaScript?
    • Bing AI Browser Web ContentBing Conversation Styles
    • ChatGPT PreviewChatGPT Introduction
    • Open Source AI Frameworks TensorFlowOpen Source AI Frameworks
    • Artificial Intelligence Tools

    Back to Top

    Links

    • Contact
    • Privacy Policy
    • Cookie Policy

    www.TestingDocs.com