/* (Start of program header comment) * Copyright and version declaration of the program part * Copyright (c) 2011, Yantai University School of Computer Students * All rights reserved. * File Name: * Author: Shangpeng * Completion Date: May 28, 2012 * Version number:
* Description of task and solution method * Input Description: * Problem Description: Window program first experience, to find the area and perimeter of the triangle
* Program Output: * Note End of program header *///mytriangle.cpp #include "stdafx.h" #include <Cmath> #include "MyTriangle.h" double Triangle: : Area (void) {double s = (a+b+c)/2; return sqrt (s* (s-a) * (s-b) * (S-C));} double Triangle::p erimeter (void) {return (A+B+C); }//mytriangle.h class Triangle {Public:triangle () {a = 1;b = 1;c = 1;} Triangle (double x,double y,double z) {a = X;b = Y;c = z;} double area (void); Double perimeter (void); Private:double A,b,c; }; triangleDlg.h void Ctriangledlg::onbnclickedbutton1 () {//TODO: Add control Notification Handler code UpdateData () here,//Will "capture" the value entered for each control on the interface To the variables associated with it Triangle T1 (m_a,m_b,m_c);//define Triangle Object M_area = T1.area ();//Area updatedata (FALSE); Update the value of the corresponding control on the interface with the value of M_area and implement the display } void Ctriangledlg::onbnclickedbutton2 () {//TODO: This adds a control to the notification handler code updatedata ();//The value entered for each control on the interface is "captured" into the variable associated with it Triangle T1 (m_a,m_b,m_c);//define the Triangle object m_perimeter = T1.perimeter ();//For Perimeter updatedata (FALSE); Update the value of the corresponding control on the interface with the value of M_perimeter and implement the display}
Experience accumulation: The first window experience Ah, he teacher's teaching is pretty detailed