#include <stdio.h>
#define PI 3.14
void main()
{
int num;
printf("请选择您要执行的操作:1.计算圆形面积2.长方形面积3.三角形面积\n");
scanf("%d",&num);
switch (num)
{
case 1:
{
double r,area;
printf("请输入圆形的半径:\n");
scanf("%lf",&r);
area=PI*r*r;
printf("圆形面积为:%.2lf\n",area);
}
break;
case 2:
{
double line,high,area;
printf("请输入长方形的长和宽:\n");
scanf("%lf,%lf",&line,&high);
area=line*high;
printf("长方形的面积为:%.2lf\n",area);
}
break;
case 3:
{
double line,high,area;
printf("请输入三角形的底和高:\n");
scanf("%lf,%lf",&line,&high);
area=(1.0/2.0)*line*high;
printf("长方形的面积为:%.2lf\n",area);
}
break;
default :
printf("没有此项操作\n");
printf("\n");
}
}