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> | |
using std::cout; | |
using std::cin; | |
int main(void) | |
{ | |
int time; | |
cin>>time; | |
if(time>=0&&time<24){ | |
if(t<=11) cout<<"おはよう"; | |
else if(t==12) cout<<"正午"; |
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 <functional> | |
#include <iostream> | |
int main(void) | |
{ | |
auto Func=[](int a){ | |
return [=](int b){ | |
return [=](int c){ | |
return a+b+c; | |
}; |
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 <functional> | |
#include <iostream> | |
using std::function; | |
using std::cout; | |
int main(void) | |
{ | |
function<int(int)> LambdaFactorial=[&](int n)->int{!n?1:n*LambdaFactorial(n-1);}; | |
cout<<LambdaFactorial(5); |
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 <cstring> | |
#include <memory> | |
#include <stack> | |
using std::cout; | |
using std::cin; | |
using std::endl; | |
using std::auto_ptr; | |
using std::stack; |
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 <map> | |
#include <functional> | |
#include <cstring> | |
using std::cout; | |
using std::cin; | |
using std::endl; | |
typedef std::pair<const char,std::function<void(void)>> Operator; |
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
/* | |
以下のコードではmapのキーとしてchar*が使われているが、 | |
ポインタ型の比較は持っているアドレスが等しいかどうかで判断するので、意図した動作はしない。 | |
この場合正しくはstd::stringを使うべき。 | |
しかし、この入門書ではVisual C++で開発している前提なので、動きが異なってくる。 | |
理由は「文字列プール」という等価な文字列リテラルは全て同一の実体として | |
(要するにコード中に"A"というリテラルが複数あった場合、それらのアドレス全て同じになる) | |
扱うように最適化する機能が有効になっている為に、当初意図していた通りに動作してしまう。 |
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
/* | |
2011.exe ソース | |
1秒毎にUNIXタイムスタンプを表示し、2011年12月31日23時59分59秒(JST)になるとアクセス違反起こして落ちます。 | |
※パソコンの時間がずれていると落ちるタイミングもずれるので注意。コンパイル・実行は自己責任の下でお願いします。 | |
作者:abc(@abcsharp) | |
*/ | |
#include <ctime> | |
#include <iostream> | |
#include <Windows.h> |
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 <map> | |
#include <functional> | |
#include <string> | |
#include <memory> | |
int main(void) | |
{ | |
typedef std::pair<const char,std::function<void(void)>> Op; | |
std::map<const char,std::function<void(void)>> Ops; |
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 <map> | |
#include <functional> | |
#include <array> | |
int main(void) | |
{ | |
std::map<const char,std::function<void(void)>> Ops; | |
std::array<unsigned char,30000> Source,Memory; | |
auto Position=Source.cbegin(); | |
auto Ptr=Memory.begin(); |
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
module Script | |
open System.IO | |
[<EntryPoint>] | |
let main (args : string[]) = | |
if args.Length = 2 then | |
let keys = | |
File.ReadAllLines(args.[0]) | |
|> Array.sort | |
|> Array.fold |
OlderNewer