设计一个程序,由用户输入半径,计算出圆周长和圆面积
发布网友
发布时间:2022-05-02 13:42
我来回答
共5个回答
热心网友
时间:2022-06-20 07:47
好像用不着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
热心网友
时间:2022-06-20 07:48
//C++语言
#include<math.h>
#include<iostream>
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<<"圆周长是:"<<circumference<<"
圆面积是:"<<square<<endl;
return
0;
}
//c语言
/*
#include<math.h>
#include<stdio.h>
#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;
}
*/
热心网友
时间:2022-06-20 07:48
//C++语言
#include<math.h>
#include<iostream>
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<<"圆周长是:"<<circumference<<" 圆面积是:"<<square<<endl;
return 0;
}
//c语言
/*
#include<math.h>
#include<stdio.h>
#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;
}
*/
热心网友
时间:2022-06-20 07:49
//C++编
include<iostream>
using namespace std;
int main(){
double x;
cin>>x;
double zc,mj;
zc=2*3.14*x;
mj=3.14*x*x;
cout<<"圆周长是:"<<zc<<" 圆面积是:"<<mj;
return 0;
}
热心网友
时间:2022-06-20 07:49
也不知道你是要什么语言的,给你几种吧
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 <iostream>
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<<"你输入的半径是"<<radiu<<endl;
cout<<"面积是"<<area<<endl;
cout<<"周长是"<<circumference<<endl;
}