Last active
March 13, 2016 15:13
-
-
Save tats-u/abd4363bf2625b8f4400 to your computer and use it in GitHub Desktop.
キヨシズンドコ節 in C++ (Zlib license/Copyright © 2016 Tats.U.)
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 <random> | |
#include <array> | |
#include <string> | |
using namespace std; | |
enum { | |
ZUN, | |
DOKO, | |
}; | |
int main() { | |
array<string, 2> str_table = {"ズン", "ドコ"}; | |
string kiyoshi = "キ・ヨ・シ!"; | |
random_device rd; | |
mt19937_64 mt(rd()); | |
uniform_int_distribution<int> dt(0,1); | |
int count = 0; | |
while(count < 5) { | |
int rand = dt(mt); | |
switch(rand) { | |
case ZUN: | |
if(count < 4) ++count; | |
break; | |
case DOKO: | |
if(count < 4) count = 0; | |
else ++count; | |
default: | |
break; | |
} | |
cout << str_table[rand] << ' '; | |
} | |
cout << kiyoshi << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment