15th Week Task 1 (program window first experience, to find the area and perimeter of the triangle)

Source: Internet
Author: User

/* (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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.