设计一个程序,由用户输入半径,计算出圆周长和圆面积

access2003,vba
2024-12-24 22:49:42
推荐回答(5个)
回答1:

好像用不着access2003吧
vb代码:
Private Sub Command1_Click()
Dim r As Single
Dim c As Single
Dim s As Single
Dim P As Single
P = 3.14
r = Int(Text1.Text)
c = 2 * P * r
s = 2 * P * r
Label1.Caption = "圆周长为 : " + Str(c)
Label2.Caption = "圆面积为 :" + Str(s)
End Sub
程序中有一个文本框text1 两个Label控件 分别是Label1,Label2

回答2:

//C++语言
#include
#include
using
namespace
std;
#define
R
3.14159
int
main()
{
double
r;
double
circumference,square;
cout<<"请输入要计算面积和周长的圆的半径:";
cin>>r;
circumference=2*R*r;
square=R*pow(r,2);
cout<<"圆周长是:"<圆面积是:"<return
0;
}
//c语言
/*
#include
#include
#define
R
3.14159
int
main()
{
double
r;
double
circumference,square;
printf("请输入要计算面积和周长的圆的半径:\n");
scanf("%lf",&r);
circumference=2*R*r;
square=R*pow(r,2);
printf("圆周长是:%f,
圆面积是:%f\n",circumference,square);
return
0;
}
*/

回答3:

//C++语言

#include
#include
using namespace std;
#define R 3.14159

int main()
{
double r;
double circumference,square;
cout<<"请输入要计算面积和周长的圆的半径:";
cin>>r;
circumference=2*R*r;
square=R*pow(r,2);
cout<<"圆周长是:"<return 0;
}

//c语言
/*
#include
#include
#define R 3.14159
int main()
{
double r;
double circumference,square;
printf("请输入要计算面积和周长的圆的半径:\n");
scanf("%lf",&r);
circumference=2*R*r;
square=R*pow(r,2);
printf("圆周长是:%f, 圆面积是:%f\n",circumference,square);
return 0;
}
*/

回答4:

//C++编
include
using namespace std;
int main(){
double x;
cin>>x;
double zc,mj;
zc=2*3.14*x;
mj=3.14*x*x;
cout<<"圆周长是:"< return 0;
}

回答5:

也不知道你是要什么语言的,给你几种吧

1.VB的

'在代码窗口中直接复制代码
Private Sub Form_Load()
Dim Radiu As Single '半径
Dim Area As Single '面积
Dim Circumference As Single '周长
Const Pi As Single = 3.141592653

Radiu = InputBox("请输入半径:", "输入")
Area = Pi * Radiu * Radiu
Circumference = 2 * Pi * Radiu
MsgBox "你输入的数是" & Radiu & vbCrLf & _
"面积是" & Area & vbCrLf & _
"周长是" & Circumference, vbInformation, "输出"
End
End Sub

2.C++的

#include

using namespace std;

int main()
{
float radiu=0, area=0, circumference=0;
const float pi = 3.14159;

cout<<"请输入半径:";
cin>>radiu;
area = pi * radiu * radiu;
circumference = 2 * pi * radiu;
cout<<"你输入的半径是"< cout<<"面积是"< cout<<"周长是"<}