例
#include <iostream> using namespace std; //计算平行四边形的面积 float CalArea(float base, float height) { return (base * height); } int main() { float base, height, Area; base = 30; height = 40; Area = CalArea(base, height); cout << "平行四边形的面积是:" << Area; return 0; }
输出结果
平行四边形的面积是:1200