今天来让我们来继续分析信息学奥赛一本通的第三道题道题,也就是来算梯形的面积。(并且,看了我的文章的人很少点赞,如果你觉得我写的好,或对你有帮助的话,请点赞,并收藏。谢谢!)计算的图如下。
这道题考查到double,以及保留小数的代码,并且考察了已知三角形面积,求三角形的高,和梯形面积。
#include
using namespace std;
int main()
{
double a, b, c, d;
a = 15;
b = 25;
c = 2 * 150 / a;
d = (a + b) * c / 2;
cout.setf (ios::fixed);
cout.precision(2);
cout << d;
return 0;
}
记得点赞!!!