Skip to content

Instantly share code, notes, and snippets.

@tats-u
Last active March 13, 2016 15:13
Show Gist options
  • Save tats-u/abd4363bf2625b8f4400 to your computer and use it in GitHub Desktop.
Save tats-u/abd4363bf2625b8f4400 to your computer and use it in GitHub Desktop.
キヨシズンドコ節 in C++ (Zlib license/Copyright © 2016 Tats.U.)
#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