Write a C + + program, input the radius of the circle from the keyboard, output the circumference and area of the circle

Write a C + + program, input the radius of the circle from the keyboard, output the circumference and area of the circle


(method 1) include
using namespace std;
#define PI 3.1415926
class Circle
{
double r;
public:
Circle(double R=0)
{
r=R;
}
void Get()
{
coutr;
}
Void cal() / / calculates the circumference and radius of a circle
{
cout



Using Java, input the radius of the circle from the keyboard, calculate the circumference and area of the circle, and output?


import javax.swing.JOptionPane ; public class yuan {public static void main (string args)} {double P, s, l, R; string str; / / where s is the area, l is the perimeter, R is the radius, P = 3.1415; STR= JOptionPane.showInputDialog (please input



Programming, input the radius of the circle from the keyboard, find the circumference and area of the circle, the following is what I do,
#include
void main ()
{
float pi=3.14;
int s,l,r;
scanf("%d \ n ",& r);
s=pi*r*r;
l=2*pi*r;
printf(%d%d\n",l,s);
}


r. S and l variables should be defined as float or double. In addition, to form a good habit, it is better to define π as constant const
Enter the recommended scanf ("% F / N", & R) ";
It is recommended to use printf for output (i.e.,% F, l, s);
Otherwise, only integers can be calculated, and the function is not strong, and the precision is too low