Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

User defined functions and variables in C++ programming

#include <iostream>
#include <cmath>

using namespace std;

void compute_area () {
	float	pie = 3.14;
	float c;
	pow(c,2)/4 * pie;
	cout << "a";
}

int main() {
	
	double c, a;
	float r;
    float	pie = 3.14;
	
	cout << "Enter value for radius:
";
	cin >> r;
	
	c = 2*pie*r;
	cout << " The circumference of the circle is
: " << c;
	
	cout << "Enter value for c:
;";
	cin >> c;
	
	a = pow(c,2)/4 * pie;
	
	cout << "The area of the circle is
:" << a;


   compute_area();

 
PREVIOUS NEXT
Tagged: #User #defined #functions #variables #programming
ADD COMMENT
Topic
Name
8+7 =