This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<memory> | |
using namespace std; | |
class Dog{ | |
string m_name; | |
public: | |
Dog(string name){cout << "Dog is created: "<< name <<endl; m_name = name;} | |
Dog(){cout << "Nameless dog created. " << name <<endl; m_nam = "nameless";} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<vector> | |
#include<regex> | |
using namespace std; | |
//regex_replace | |
int main() { | |
string str = "zhangxm01@gmail.com; zhan@163.com; zhan_j@yahoo.com"; | |
regex e("([[:w:]]+)@([[:w:]]+)\.com"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<vector> | |
#include<regex> | |
using namespace std; | |
//regex_token_iterator: pointing to a sub match | |
int main() { | |
string str = "zhangxm01@gmail.com; zhan@163.com; zhan_j@yahoo.com"; | |
regex e("([[:w:]]+)@([[:w:]]+)\.com"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<vector> | |
#include<regex> | |
using namespace std; | |
//We can use regular expression iterator here! | |
int main() { | |
string str = "zhangxm01@gmail.com; zhan@163.com; zhan_j@yahoo.com"; | |
regex e("([[:w:]]+)@([[:w:]]+)\.com"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<vector> | |
#include<regex> | |
using namespace std; | |
int main() { | |
string str; | |
while (true) { | |
cin >> str; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<string> | |
#include<vector> | |
#include<regex> | |
using namespace std; | |
//Basic grammar | |
int main(){ | |
string str; | |
while(true){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<vector> | |
#include<string> | |
#include<iterator> | |
using namespace std; | |
/******************************************************************************************************/ | |
/* 1. Initializer list */ | |
//Implemented by initilaizer list constructor | |
vector<int> v = {1, 4, 6, 10}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for a binary tree node. | |
* struct TreeNode { | |
* int val; | |
* TreeNode *left; | |
* TreeNode *right; | |
* TreeNode(int x) : val(x), left(NULL), right(NULL) {} | |
* }; | |
*/ | |
class Solution { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for a binary tree node. | |
* struct TreeNode { | |
* int val; | |
* TreeNode *left; | |
* TreeNode *right; | |
* TreeNode(int x) : val(x), left(NULL), right(NULL) {} | |
* }; | |
*/ | |
class Solution { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for a binary tree node. | |
* struct TreeNode { | |
* int val; | |
* TreeNode *left; | |
* TreeNode *right; | |
* TreeNode(int x) : val(x), left(NULL), right(NULL) {} | |
* }; | |
*/ | |
class Solution { |