![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
cpp
wezzdo
xxxxx
展开
-
引用
引用 refrence为对象起的另一个名字,声明符写为 &d 的形式来定义引用类型 int ival=1024; int &refval=ival; //refval指向ival; int &refval2; //error:引用必须初始化原创 2018-02-05 11:25:02 · 231 阅读 · 0 评论 -
顺序容器
#include<list>#include<vector>#include<string>#include<queue>#include<forward_list>#include<iostream>#include<array>int main() { using namespace st原创 2018-02-05 15:22:18 · 165 阅读 · 0 评论 -
c++ cctype
#include&lt;iostream&gt;#include&lt;cctype&gt;int main(){ using namespace std; cout&lt;&lt;"Enter text for analysis, an type @" "to terminate input.\n";原创 2019-01-11 03:54:08 · 281 阅读 · 0 评论 -
c++ string类
ISO/ANSI C++98标准通过添加string类扩展了C++库,因此现在可以string类型的变量(使用C++的话说是对象)而不是字符数组来存储字符串要使用string类,必须在程序中包含头文件string。string类位于名称空间std中,因此您必须提供一条using编译指令,或者使用std::string来引用它。string类定义隐藏了字符串的数组性质,让您能够像处理普通变量那样处...原创 2019-01-11 04:48:02 · 96 阅读 · 0 评论 -
strback.cpp
#include<iostream>char * bulidstr(char,int);int main(){ using namespace std; int times; char ch; cout<<"Enter acharacter: "; cin>>ch; cout<<"Ent...原创 2019-01-13 00:17:46 · 123 阅读 · 0 评论 -
函数模板
作用:使用泛型来定义函数,其中的可用具体类型(如int或double)替换,通过将类型作为参数传递给模板,可使编译器生成该类型的函数template<typename T>void Swap(T &a,T &b){ T temp; temp=a; a=b; b=temp;}重载的模板template<typename T>vo...原创 2019-01-23 13:58:41 · 150 阅读 · 0 评论 -
析构函数
用构造函数创建对象后,程序负责跟踪该对象,直到其过期为止。对象过期时,程序将自动调用一个特殊的成员函数,该函数的名称令人生畏——析构函数。析构函数完成清理工作,因此实际上很有用。例如,如果构造函数使用new来分配内存,则析构函数将使用delete来释放这些内存。Stock的构造函数没有使用new,因此析构函数实际上没有需要完成的任务。在这种情况下,只需让编译器生成一个什么要不做的隐式析构函数即可,...原创 2019-02-08 23:05:42 · 833 阅读 · 0 评论 -
stock cpp
stock.h#pragma once#ifndef STOCK_H_#define STOKC_H_#include <string>class Stock {private: std::string company; long shares; double share_val; double total_val; void set_tot() { tot...原创 2019-02-09 00:13:39 · 220 阅读 · 2 评论