Mercurial > mercurial > hgweb_kaigo.hg.cgi
comparison horori/console/xor.cpp @ 0:aaaa401818a1 draft
first commit.
| author | pyon <pyon@macmini> |
|---|---|
| date | Mon, 24 May 2021 21:32:58 +0900 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:aaaa401818a1 |
|---|---|
| 1 /* console.cpp | |
| 2 * Last Change: 2020-04-28 火 18:26:49. | |
| 3 * by T.Mutoh | |
| 4 */ | |
| 5 #include "wx/wxprec.h" | |
| 6 | |
| 7 #include <wx/wx.h> | |
| 8 #include <wx/app.h> | |
| 9 #include <wx/cmdline.h> | |
| 10 | |
| 11 static const wxCmdLineEntryDesc cmdLineDesc[] = | |
| 12 { | |
| 13 {wxCMD_LINE_SWITCH, "h", "help", "show this help message", | |
| 14 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP}, | |
| 15 {wxCMD_LINE_SWITCH, "d", "dummy", "a dummy switch", | |
| 16 wxCMD_LINE_VAL_NONE, 0}, | |
| 17 {wxCMD_LINE_SWITCH, "s", "secret", "a secret switch", | |
| 18 wxCMD_LINE_VAL_NONE, wxCMD_LINE_HIDDEN}, | |
| 19 // ... your other command line options here... | |
| 20 | |
| 21 wxCMD_LINE_DESC_END | |
| 22 }; | |
| 23 | |
| 24 int main(int argc, char **argv) | |
| 25 { | |
| 26 wxApp::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE, "program"); | |
| 27 | |
| 28 wxInitializer initializer; | |
| 29 if (!initializer) { | |
| 30 fprintf(stderr, "Failed to initialize the wxWidgets library, aborting."); | |
| 31 return -1; | |
| 32 } | |
| 33 | |
| 34 wxString s = argv[1]; | |
| 35 //wxString buf = argv[2]; | |
| 36 int x = wxAtoi(argv[2]); | |
| 37 wxString t; | |
| 38 | |
| 39 for (int i = 0; i < s.Len(); i++) { | |
| 40 t += wxString::Format(wxT("%c"), s[i].GetValue() ^ x); | |
| 41 } | |
| 42 wxPrintf(t + wxT("\n")); | |
| 43 | |
| 44 return 0; | |
| 45 } | |
| 46 |
