ロト6の疑問at LOTO
ロト6の疑問 - 暇つぶし2ch380:名無しさん@夢いっぱい
09/02/25 10:31:39 D2QzVmyY
// 【ファイル名】itchi.js
// 【準備】メモ帳などのテキストエディタでロト6の結果および検索対象を名前を付けて保存する("loto6.txt")
// 【実行】cscript itchi.js

a = new Array("01", "02", "03", "04", "05", "06");
s = WScript.CreateObject("Scripting.FileSystemObject");
text = s.OpenTextFile("loto6.txt", 1);

string = text.ReadLine();// 1行目にロト6の結果がある
for(i = 0, j = 0; i < 6; i++, j = j + 3) {
  a[i] = string.substr(j, 2);// ロト6の結果で配列を更新した
}

while(! text.AtEndOfStream) {
  string = text.ReadLine();
  c = 0;

  for(i = 0; i < 6; i++) {
    f = string.indexOf(a[i], 0)
    if(f != -1) {// 一致した
      c++;
    }
  }

  if(c >= 3) {// 3個以上、一致した
    WScript.Echo(string + ": " + c + " matches");// たとえば、05 08 16 25 26 30: 4 matches
  }
}

text.Close();


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch