Skip to content

Instantly share code, notes, and snippets.

View zhangxiaomu01's full-sized avatar
🎯
Focusing

Jun Zhang zhangxiaomu01

🎯
Focusing
View GitHub Profile
#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";}
#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");
#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");
#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");
#include<iostream>
#include<string>
#include<vector>
#include<regex>
using namespace std;
int main() {
string str;
while (true) {
cin >> str;
#include<iostream>
#include<string>
#include<vector>
#include<regex>
using namespace std;
//Basic grammar
int main(){
string str;
while(true){
#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};
/**
* 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 {
/**
* 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 {
/**
* 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 {