Created
April 21, 2016 14:52
-
-
Save KentaYamada/53418e25f0d1f81e48920eb02f513a9f to your computer and use it in GitHub Desktop.
Vectorを参照渡しして使う
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 <string> | |
| #include <vector> | |
| using namespace std; | |
| vector<unsigned int> runs; | |
| static void InitRuns() | |
| { | |
| runs.push_back(0x20); | |
| runs.push_back(0x40); | |
| } | |
| static unsigned int Check(const vector<unsigned int> &condition, unsigned int value) | |
| { | |
| for(size_t i = 0; i < condition.size(); ++i) | |
| { | |
| if(condition[i] == value) | |
| { | |
| return 1; | |
| } | |
| } | |
| return 0; | |
| } | |
| int main(int argc, char *argv[]) | |
| { | |
| unsigned int a = 0x20; | |
| unsigned int b; | |
| InitRuns(); | |
| b = Check(runs, a); | |
| cout << "Value: " << b << endl; | |
| return 0; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment