[Cpp]/** Copyright and version statement of the program section * Copyright (c) 2013, student * All rightsreserved from computer College of Yantai University. * file name: score. cpp * Author: Zhang Hao * Completion Date: July 15, March 23, 2013 * version: v1.0 * input Description: * Problem description: design class for Triangle Area and perimeter * program output: triangle Area and perimeter */# include <iostream> # include <Cmath> using namespace std; class Triangle {private: double a, B, c; // The three sides are private member data public: void getABC (double * x, double * y, double * z); // obtain the value double perimeter (void ); // calculate the triangle perimeter double area (void); // Calculate and return the Triangle Area}; void Triangle: getABC (double * x, double * y, double * z) {a = * x; B = * y; c = * z;} double Triangle: perimeter () {double m; m = a + B + c; return m;} double Triangle: area (void) {double s, p; p = (a + B + c) x 0.5; s = sqrt (p * (p-a) * (p-B) * (p-c); return s;} int main () {Triangle tri1; double x = 0, y = 0, z = 0; cout <"Enter the three sides of the triangle:" <endl; cin> x> y> z; while (x + y <= z) | (x + z <= y) | (y + z <= x) {cout <"does not constitute three Angular! Re-enter ...... "<endl; cin> x> y> z;} tri1.getABC (& x, & y, & z); cout <" the three sides are: "<x <'\ t' <y <' \ t' <z <endl; cout <" the triangle perimeter is: "<tri1.perimeter () <'\ n' <" Triangle Area: "<tri1.area () <endl; return 0;} running result: