/** Program Copyright and version description Section * copyright (c) 2012, Yantai University Computer college student * All rightsreserved. * file name: object. CPP * Author: Li Yang * Completion Date: July 15, March 22, 2013 * version: V1.0 * input Description: none * Problem description: design class for triangle circumference and area. * Program output: triangle length and area */# include <iostream> # include <cmath> using namespace STD; Class triangle {public: void setabc (Double X, double y, double Z); // set the value of the three sides. Be sure to convert it into a triangle void getabc (double * X, double * y, double * z ); // double perimeter (void); // calculate the triangle perimeter double area (void); // calculate and return the Triangle Area PRIVATE: Double A, B, c; // the three sides are private member data}; int main () {triangle tri1; // defines an instance of the triangle class (object) tri1.setabc (, 6 ); // Double X, Y, Z; tri1.getabc (& X ,& Y, & Z); // assign the three sides X, Y, and Z to cout <: "<x <'\ t' <Y <' \ t' <z <Endl; cout <" the triangle perimeter is: "<tri1.perimeter () <'\ t' <" Area: "<tri1.area () <Endl; return 0;} void triangle :: setabc (Double X, Double Y, Double Z) {If (x + y> C & x + z> C & Y + z> X) {A = X; B = y; C = z;} elsecout <"this data cannot constitute a triangle! "<Endl;} void triangle: getabc (double * X, double * y, double * z) {* x = A; * Y = B; * z = C;} double triangle: Perimeter (void) {return (A + B + C);} double triangle: Area (void) {double S; S = (A + B + C)/2; Return (SQRT (S * (S-A) * (S-B) * (s-c )));}