随笔分类 - 实践考核
深大自学考试
摘要:/*people是基类,student和graduate是子类,重载“==”运算符输入2个学生的信息:姓名、编号、身份证号、班级、专业输入1个研究生的信息:姓名、编号、身份证号、班级、专业、导师重载“==”,当两个学生的编号相同时,调用重载运算符,输出错误信息。*/ #include <iostre
阅读全文
摘要:一、 #include <iostream>#include <string>using namespace std; int main(){ int n, i; cout << "请输入几个字符串:"; cin >> n; string *p; string *A = new string[n];
阅读全文
摘要:无向图的邻接表存储方法 源程序: #include <stdio.h>#include <stdlib.h>#define VNUM 100 //顶点的类型typedef char VerType;typedef struct arcnode{ int adjvex; //下一条边的顶点编号 str
阅读全文
摘要:图的带权邻接矩阵存储 源程序: #include <stdio.h>#include <stdlib.h>#define VNUM 20const int MAX_INT=0; //图的类型定义typedef struct gp{ char vexs[VNUM]; int arcs[VNUM][VN
阅读全文
摘要:图的邻接矩阵存储 源程序 #include <stdio.h>#include <stdlib.h> const int vnum=20; //定义图的类型typedef struct gp{ char verx[vnum]; int arcs[vnum][vnum]; int vernum,arc
阅读全文
摘要:二叉树操作 左右子树交换后的二叉树 //二叉树的实现#include <iostream>using namespace std;//二叉树的结点定义typedef struct bitreenode{ char data; struct bitreenode *lchild,*rchild;}*B
阅读全文
摘要:抽象类-编写一个程序,用于计算正方形、矩形、直角三角形和圆的面积之和。 源程序: //纯虚函数与抽象类#include <iostream>using namespace std;class shape //shape类中有纯虚函数,所以shape是抽象类,抽象类定义的对象也是抽象的,只能用指针对象
阅读全文
摘要:请编写一个抽象类shape,在此基础上派生出类Rectangle和Circle,两者都有计算面积的函数GetArea()、计算对象周长的函数GetPerim()。 抽象类 源程序: #include<iostream> #define PI 3.1415926; using namespace st
阅读全文
摘要:多态的实现 源程序: #include <iostream> #include <cmath> using namespace std; class CShape { protected: double acreage; public: CShape() { //cout<<"基类构造函数"<<en
阅读全文
摘要:源程序: #include <iostream>#include <algorithm>#include <functional>#include <iomanip>#include <stdlib.h>const int MAXSIZE = 10;using namespace std; int*
阅读全文
摘要:源程序: 头函数:menu.h #pragma once#if!(menu_H)#define menu_h#include <iostream>using namespace std; class calc{private: int a, b; int p, m;public: calc() {}
阅读全文
摘要:源程序: #include <iostream>#include <stdlib.h>const int MaxSize = 8;using namespace std; typedef struct{ int stuno; string stuname; int stuage;}TableElem
阅读全文
摘要:源程序: #include <iostream>#include <string>#define N 4using namespace std; class student{private: int num; string name; string sex; int age;public: stud
阅读全文