C++
zenkle
这个作者很懒,什么都没留下…
展开
-
数据结构——线性表
#ifndef seqlist_hpp #define seqlist_hpp #include <stdio.h> using namespace std; class seqlist{ public: seqlist(int msize); ~seqlist(); bool isEmpty(); bool isFull(); void l...原创 2018-09-18 15:34:58 · 102 阅读 · 0 评论 -
C++类常量成员和引用型变量初始化
#include <iostream> using namespace std; class CDemo{ private: const int num; int & ref; public: CDemo(int &n):num(n), ref(n){//引用和常量成员初始化必须赋值,且只能在参数列表中赋值 ...原创 2018-09-18 17:42:07 · 445 阅读 · 0 评论 -
随机数问题
1、随机数问题:希望掉落2或者4。 1⃣️使用 std::time() 函数取得一个每次都不一样的时间作为种子数值 2⃣️使用 std::srand() 函数设置这个种子数值初始化随机数发生器 3⃣️使用 std::rand() 函数根据我们所需要缩放的范围进行取余处理制造我们所需要的随机数 1.1 std::time() 函数 传入 NULL 空值,就能...原创 2018-09-18 15:29:04 · 263 阅读 · 0 评论 -
数据结构——单链表
#include<iostream> #include<stdlib.h> using namespace std; class Node{ public: int data; Node* next; void ptrintNode(){ cout << data << endl; } }; class singleList{ pub...原创 2018-09-22 16:12:57 · 132 阅读 · 0 评论 -
数据结构——栈
#include<iostream> #include<stdlib.h> using namespace std; class stack{ public: stack(int msize); ~stack(); bool isEmpty(); bool isFull(); int length(); bool push(char x); bool pop...原创 2018-09-22 16:14:53 · 90 阅读 · 0 评论