原创 Python數字與字符之間的轉換

Python數字與字符之間的轉換 命令 意義 int(x [,base ]) 將x轉換爲一個整數 long(x [,base ]) 將x轉換爲一個長整數 float(x ) 將x轉換到一個浮點數 compl

原创 C++11中的四種智能指針

前言 C++ STL 提供了四種智能指針:auto_ptr、unique_ptr、shared_ptr 和 weak_ptr。其中auto_ptr 是 C++98 提供的解決方案,C+11 已將其摒棄,並提出了 unique_pt

原创 C++判斷一個字符串中是否全是數字

#include <iostream> #include <cstdio> using namespace std; bool IsdigitAll(string str) { for (int i = 0; i<str

原创 C++中對vector所有元素求和

兩種實現方式: 一種是自己寫循環求和。 一種是使用numeric中的accumulate函數進行求和。 #include <iostream> #include <vector> #include <numeric> using

原创 C++11中的智能指針shared_ptr

多個shared_ptr可以指向同一個對象,當對象不再使用時,shared_ptr被自動清理。 #include <iostream> #include <string> #include <vector> #include <m

原创 C++類的構造函數列表初始化

#include <iostream> using namespace std; class Point { public: // 類的構造函數列表初始化 Point(int x, int y) :m_x(x)

原创 C++中string實戰操作

前九位是uid,第十位是下劃線,後面全是token字符串 #include<iostream> #include<string> #include <cstdio> using namespace std; int main(

原创 大整數相乘——兩個不超過100位的整數相乘

#include <iostream> #include <cstring> using namespace std; int main() { char sz1[100], sz2[100]; cin >> s

原创 C++任意數值類型轉string

#include<iostream> #include<sstream> using namespace std; template<class T> string ToString(T value) { string

原创 C++11中pair的用法

概述 pair可以將兩個數據組合成一種數據類型。 C++標準庫中凡是必須返回兩個值的函數都使用pair。 pair有兩個成員變量,分別是first和second,由於使用的struct而不是class,因此可以直接訪問pair的

原创 matlab對文件目錄進行自然排序

作者:tongqingliu 轉載請註明出處:http://blog.csdn.net/qq_22186119/article/details/73662415 matlab對文件目錄進行自然排序 比如我新建一個tmp文

原创 C++基本內置類型

C++基本內置類型 基本內置類型包括算術類型和空類型。 算術類型 算術類型包括整型和浮點型。 類型 含義 最小尺寸 bool 布爾型 - char 字符型 8 bit wchar_t 寬字符型 16 bit

原创 Ubuntu16.04配置Mac主題

Ubuntu16.04配置Mac主題 下載Mac壁紙 鏈接: https://pan.baidu.com/s/1c19iNvE 密碼: yd2h 更新 sudo apt-get update sudo apt-get upgra

原创 sublime將python的運行結果在命令行顯示

sublime將python的運行結果在命令行顯示 爲什麼這麼折騰? 因爲每次查看輸出結果都要上下拖動窗口,很煩。 將build system修改爲 { "cmd": ["start", "cmd", "/k", "C:

原创 C++順序容器之deque初探

C++順序容器之deque初探 deque是雙端隊列,與vector非常相似,是順序容器,不同的是,deque可以在數組開頭和末尾插入和刪除數據。支持快速隨機訪問。 #include<iostream> #include<dequ