2014220902010-赵天豪-实验5(3)

2019-04-09 15:12

};

}

p = p->next; //请自行添加指针移动部分

}//遍历

List& operator=(const List& l) {

head = tail = NULL; Node *p = l.head; while (p != NULL) { } len = 0; return *this;

this->push_back(p->data); p = p->next;

}

List& operator+=(const QUADPTR& data) { }

QUADPTR& operator[](size_t n) { }

Node *p = head;

for (size_t i = 1; i <= n; i++){ }

return p->data;

p = p->next;

Node *p = new Node(data); p->next = NULL; if (tail == NULL) } len++; return *this;

head = tail = p; tail->next = p; tail = p; else{

Para.h:

#pragma once #include #include #include\ #include \ using namespace std; class Para : public Quadrangle { public: };

Para(int w = 5, int h = 7, string nm = \) :width(w), height(h), Quadrangle(nm){}; ~Para(){};

void draw() const{ Canvas::drawQuad(this); }; double area() const{ return width*height; }; string what() const{ return Quadrangle::what(); };

int& Width(){ return width; }; //获取矩形的宽。如果是梯形,还需要一个成员int& Width2()来获取int& Height(){ return height; };//获取矩形的高

friend ostream&operator<<(ostream& os, const Para &c3); Para&operator=(const Para&pa) { } int width; int height;

name = pa.name; width = pa.width; height = pa.height; return *this;

另一条平行边的长度

protected:

Quad.h:

#pragma once #include #include \ using namespace std;

class Quadrangle { protected: };

typedef Quadrangle * QUADPTR;

string name; //形体的标识

Quadrangle(string nm =\ ) :name(nm){} virtual double area() const =0; string what() const{ return name; }; virtual void draw() const=0; public:

Rect.h:

#pragma once #include #include #include\ #include \ using namespace std; class Rect : public Para { public: };

Rect(int w = 4, int h = 8, string nm = \) :Para(w,h,nm){}; ~Rect(){};

string what()const{ return Para::what(); }; double area()const{ return Para::area(); } void draw()const{ Canvas::drawQuad(this); } int Width()const{ return width; } int Height()const{ return height; }

friend ostream&operator<<(ostream& os, const Rect &c1); Rect&operator=(const Rect&re) { }

name = re.name; width = re.width; height = re.height; return *this;

Resource.h:

//{{NO_DEPENDENCIES}}

// Microsoft Visual C++ generated include file. // Used by experiment.rc //

#define IDM_ABOUTBOX #define IDD_ABOUTBOX #define IDS_ABOUTBOX #define IDD_EXPERIMENT_DIALOG #define IDR_MAINFRAME #define IDC_EDIT_ANSWER #define IDC_BUTTON_SUBMIT #define IDC_BUTTON_NEXT #define IDC_BUTTON_STOP #define IDC_EDIT_RESULT #define IDC_STATIC_GROUP

// Next default values for new objects //

#ifdef APSTUDIO_INVOKED

#ifndef APSTUDIO_READONLY_SYMBOLS

#define _APS_NEXT_RESOURCE_VALUE #define _APS_NEXT_COMMAND_VALUE #define _APS_NEXT_CONTROL_VALUE #define _APS_NEXT_SYMED_VALUE #endif #endif

Squa.h:

#pragma once #include #include #include\ #include \ using namespace std; class Square : public Rect

0x0010 100 101 102 128 1000 1001 1002 1003 1005 129 32771 1006 101 1004 { public: };

friend ostream&operator<<(ostream& os, const Square &c4); Square&operator=(const Square&sq) { }

name = sq.name; width = sq.width; return *this;

Square(int w = 6, string nm = \) :Rect(w,w,nm){}; ~Square(){};

void draw() const{ Rect::draw(); }; double area() const{ return width*width; }; string what() const{ return Rect::what(); }; int& Width(){ return width; };

Stdafx.h:

// stdafx.h : 标准系统包含文件的包含文件, // 或是经常使用但不常更改的 // 特定于项目的包含文件

#pragma once

#ifndef _SECURE_ATL #define _SECURE_ATL 1 #endif

#ifndef VC_EXTRALEAN

#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料 #endif

#include \

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的

// 关闭 MFC 对某些常见但经常可放心忽略的警告消息的隐藏 #define _AFX_ALL_WARNINGS


2014220902010-赵天豪-实验5(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:测试技术参考答案(王世勇,前三章)

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: