This file contains hidden or 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
| /*************************************************************************** | |
| * @file The code is for the exercises in C++ Primmer 5th Edition | |
| * @author Alan.Wang | |
| * @date 22 DEC 2013 | |
| * @remark | |
| ***************************************************************************/ | |
| //! | |
| //! Exercise 12.1: | |
| //! How many elements do b1 and b2 have at the end of this code? | |
| // b1 : 4 |
This file contains hidden or 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
| [ | |
| { | |
| name:"HTML5", | |
| uri:"http://www.w3.org/TR/html5/single-page.html", | |
| category:"markup" | |
| }, | |
| { | |
| name:"HTML 5.1", | |
| uri:"http://www.w3.org/TR/html51/single-page.html", | |
| category:"markup" |
This file contains hidden or 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> | |
| using std::cout; using std::endl; using std::begin; using std::end; | |
| int main() | |
| { | |
| constexpr size_t rowCnt = 3, colCnt = 4; | |
| int ia[rowCnt][colCnt]; | |
| // subscirpting |
This file contains hidden or 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
| // | |
| // main.cpp | |
| // Test | |
| // | |
| // Created by pezy on 9/11/14. | |
| // Copyright (c) 2014 PEZY. All rights reserved. | |
| // | |
| #include<iostream> | |
| using namespace std; |
This file contains hidden or 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
| const osg::Vec4 toVec4(const QColor &color) | |
| { | |
| return osg::Vec4( | |
| color.redF() | |
| , color.greenF() | |
| , color.blueF() | |
| , color.alphaF()); | |
| } | |
| const QColor toQColor(const osg::Vec4 &color) |
This file contains hidden or 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 <map> | |
| #include <string> | |
| #include <fstream> | |
| std::string num2Chinese(int num, std::map<int, std::string> &map) { | |
| std::string ret; | |
| bool twenty{num > 20}; | |
| bool remnant{num > 100 && num/10%10 == 0}; | |
| for (auto it=map.crbegin(); it != map.crend(); ++it) { | |
| int count=0; |
This file contains hidden or 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 <windows.h> | |
| #include <stdio.h> | |
| void main() | |
| { | |
| HANDLE hFile; | |
| HANDLE hAppend; | |
| DWORD dwBytesRead, dwBytesWritten, dwPos; | |
| BYTE buff[4096]; |
This file contains hidden or 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
| data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/textmate");e.getSession().setMode("ace/mode/c_cpp");</script> |
This file contains hidden or 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 <algorithm> | |
| class Solution { | |
| int partition(int arr[], int l, int r) { | |
| int index = l, pivot = arr[r]; | |
| for (int i=l; i<r; ++i) | |
| if (arr[i] <= pivot) std::swap(arr[i], arr[index++]); | |
| std::swap(arr[index], arr[r]); | |
| return index; | |
| } |
This file contains hidden or 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 <initializer_list> | |
| struct ListNode { | |
| int val; | |
| ListNode *next; | |
| ListNode(int x) : val(x), next(nullptr) {} | |
| }; | |
| ListNode *create_linkedlist(std::initializer_list<int> lst) |