博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
怎么计算任意矩形交圆形面积_C ++程序根据用户的选择来计算圆形,矩形或三角形的面积...
阅读量:2508 次
发布时间:2019-05-11

本文共 1304 字,大约阅读时间需要 4 分钟。

怎么计算任意矩形交圆形面积

#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{


clrscr(); //to clear the screen
float a,b,c,s,r,area;
int ch;
cout<<“***Menu***n1.Area of circlen2.Area of Rectangle”;
cout<<“n3.Area of trianglenEnter your choice:”;
cin>>ch;

switch(ch)
{

case 1:
{

cout<<“nEnter radius of the circle:”;
cin>>r;
area=3.14*r*r;
break;
}
case 2:
{

cout<<“nEnter length and breadth:”;
cin>>a>>b;
area=a*b;
break;
}
case 3:
{

cout<<“nEnter three sides of the triangle:”;
cin>>a>>b>>c;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
break;
}
default: cout<<“nWrong choice…!!!”;
break;
}

cout<<“Area=”<<area;
getch(); //to stop the screen
}

#include<iostream.h>
#include<conio.h>
#include<math.h>

void main()
{


clrscr(); //to clear the screen
float a,b,c,s,r,area;
int ch;
cout<<“***Menu***n1.Area of circlen2.Area of Rectangle”;
cout<<“n3.Area of trianglenEnter your choice:”;
cin>>ch;

switch(ch)
{

case 1:
{

cout<<“nEnter radius of the circle:”;
cin>>r;
area=3.14*r*r;
break;
}
case 2:
{

cout<<“nEnter length and breadth:”;
cin>>a>>b;
area=a*b;
break;
}
case 3:
{

cout<<“nEnter three sides of the triangle:”;
cin>>a>>b>>c;
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
break;
}
default: cout<<“nWrong choice…!!!”;
break;
}

cout<<“Area=”<<area;
getch(); //to stop the screen
}

翻译自:

怎么计算任意矩形交圆形面积

转载地址:http://srwwd.baihongyu.com/

你可能感兴趣的文章
hdu 2066 一个人的旅行 解题报告
查看>>
完美获取浏览器滚动条卷去的高度
查看>>
PID参数整定快速入门(调节器参数整定方法)
查看>>
[Effective JavaScript 笔记]第39条:不要重用父类的属性名
查看>>
Highcharts使用指南
查看>>
网络基础(子网划分)
查看>>
Google C++ Style
查看>>
微软阵营企稳的利好消息:.NET开源、Visual Studio免费
查看>>
MyBatis总结八:缓存介绍(一级缓存,二级缓存)
查看>>
div+css教程网站建设门户网站和电子商务网站CSS样式表
查看>>
[LeetCode][JavaScript]Candy
查看>>
Mybatis分页插件
查看>>
安卓开发笔记——高仿新浪微博文字处理(实现关键字高亮,自定义表情替换并加入点击事件实现)...
查看>>
Java基础回顾 —I/O
查看>>
解决 samba不允许一个用户使用一个以上用户名与一个服务器或共享资源的多重连接...
查看>>
css3选择器-边框-阴影效果
查看>>
C语言中short的意思
查看>>
Window phone8中pdf文件预览
查看>>
产生冠军 map 的 应用 .
查看>>
Xcode4快速Doxygen文档注释 — 简明图文教程
查看>>