原创 [c語言]數據結構 順序表的實現

首先是main.cpp讓我們來看看都有什麼函數 #include<iostream> #include"SeqList.h" using namespace std; int main() { SeqList mylist;

原创 [c++]容器類。繼承類的構造和析構

#include<iostream> using namespace std; class Base { int x; public: Base(int a) { x = a; co

原创 [c++]複數的運算符重載

類的定義和聲明: <span style="font-size:32px;">#include<iostream> #include<string> using namespace std; class Complex {

原创 [c++]怎麼樣知道析構函數先後的析構順序

#include<iostream> #include<string.h> using namespace std; class String_date { private: char * str; public: Str

原创 [c++]cylinder顯示每個對象的體積

#include<iostream> using namespace std; #define p 3.1415926 class Cylinder { private: double v; public: Cylin

原创 【數據結構】鏈棧

Lstack.h #pragma once #include<iostream> #include <stdlib.h> using namespace std; #define Elemtype int typedef st

原创 [c++]對象指針,引用的操作

1.time類保存在“htime.h”中,要求: ⑴ 數據成員包含時(hour)、分(minute)、秒(second),爲私有成員; ⑵ 能給數據成員提供值的成員函數(默認值爲0時0分0秒); ⑶ 能分別取時、分、秒; ⑷ 能輸出時、分

原创 [c++]多繼承

多繼承格式: class 類名:繼承方式1 基類1,繼承方式2 基類2,........ #include<iostream> using namespace std; class X { int x; public: X

原创 [c++]友元函數

其中有2個類:一個是深圳類shen_stock,一個是上海類shang_stock,類中有3個私有成員:普通股票個數general,ST股票個數st和PT股票個數pt,每個類分別有自己的友元函數來計算並顯示深圳或上海的股票總數(3項的和)

原创 [c++]派生類的構造函數和析構函數

#include<iostream> using namespace std; class Base { float x; float y; public: Base(float a,float b) {

原创 [c++]派生類的應用

在已有的Point類的基礎上,定義一個“Circle”派生類,要求:新增一個半徑成員;能計 算並輸出圓的周長及加圓面積       #ifndef __Dervide_circle__circle__ #define __Dervide_

原创 [c++]抽象類

如果一個類至少有一個純虛函數,就稱該類爲抽象類,目的是用它作爲基類去建立派生類。 規定: 1.抽象類中至少包含一個沒有定義功能的純虛函數,因此,抽象類只能作爲其他類的基類來使用,不能建立抽象類對象。 2.不允許從具體類(不包含純虛函數)派

原创 [c++]運算符重載

類的聲明: #ifndef new_c___homework_operator_h #define new_c___homework_operator_h #include<iostream> using namespace std;

原创 [c++]容器類

#include<iostream> #include<string.h> using namespace std; class string1 { private: char *str; public: string1(

原创 【數據結構】順序棧

Stack.h #pragma once #include<stdlib.h> #include<iostream> using namespace std; #define SIZE 10 #define Elemtype in