#include<iostream>
#include<math.h>
using namespace std;
void main()
{
int a, b, c, s;
cout << "please enter a,b,c:" << endl;
cin >> a >> b >> c;
s = (a + b) * c / 2;
cout << "s="<<s;
}
#include<iostream>
#include<math.h>
void main()
{
int a, b, c, s;
printf("please enter a,b,c:\n");
std::cin >> a >> b >> c;
s = (a + b) * c / 2;
std::cout << "s="<<s;
本文提供了一个简单的C++程序,用于计算三角形的面积。用户输入三角形的两个边长及夹角对应的对边长度,程序将计算并输出该三角形的面积。此代码适用于初学者了解基本的输入输出及算术运算。
498

被折叠的 条评论
为什么被折叠?



