zoukankan      html  css  js  c++  java
  • 第七周项目2-自选图形用户界面程序开发

    经过这几天的使用VS,发现其实和VB还是有一些相同的地方,所以对于控件还是能够很好的了解他们的作用。

    这是今天上机的时候写得一个“长方体求解”的程序,主要还是多练习练习,熟悉一下。

    创建一个“Bank”项目,在bankget.h中,创建一个类:

    class Bank
    {
    private:
    	int leight;
    	int weight;
    	int height;
    public:
    	void get(int, int, int);
    	int getarea();
    	int getvo();
    };

    在bankget.cpp中,完成内置函数的声明:

    #include "stdafx.h"
    #include "Bank.h"
    #include "bankget.h"
    void Bank::get(int l, int w, int h)
    {
    	leight = l;
    	weight = w;
    	height = h;
    }
    int Bank::getarea()
    {
    	return (2 * (leight*weight + weight*height + leight*height));
    }
    int Bank::getvo()
    {
    	return (leight*height*weight);
    }

    在BankDlg.cpp中,增加对按钮button的函数实现:

    void CBankDlg::OnBnClickedButton1()
    {
    	UpdateData();
    	Bank b1;
    	b1.get(b_l, b_w, b_h);
    	b_area = b1.getarea();
    	b_vo = b1.getvo();
    	UpdateData(false);
    
    }

    结果如图:



    @ Mayuko


  • 相关阅读:
    网络和笔记本
    病毒惹的祸
    Virtual MachineVmware(2)
    VS2010 工具箱装载出错
    Virtual Machine VmWare(1)
    javascript写计数器
    代码自动生成操作
    用live writer写博客
    上海招聘.net程序员
    将用户导入到membership
  • 原文地址:https://www.cnblogs.com/mayuko/p/4567504.html
Copyright © 2011-2022 走看看