5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

奇数か?偶数か?

Last updated at Posted at 2019-06-27

D9_V8O8U8AEQ_xH.jpg

まじめに実装しました。

odd.c
#include <stdio.h>

int main() {
  unsigned long max = 4294967295;
  FILE *out = fopen("odd.vbs", "w");
  fprintf(out, "Public Function a(b)\n\tSelect Case b");
  for(unsigned long i = 1; i <= max; i++) {
    fprintf(out, "\n\t\tCase %lu\n\t\t\ta = %s", i, i & 1 ? "True" : "False");
  }
  fprintf(out, "\n\tEnd Select\nEnd Function");
  fclose(out);
  return 0;
}

以下を実行すると、

gcc odd.c && ./a.out

このようなvbのコードが生成されます。(117GB)

Public Function a(b)
    Select Case b
        Case 1
            a = True
        Case 2
            a = False
        Case 3
            a = True
        Case 4
            a = False
          :
        (中略)
          :
        Case 4294967295
            a = True
    End Select
End Function

可読性が非常に高いですね!Long型をサポートしてとても親切設計です。

gitで管理すると炎上間違えなしです!納品物に含めると大変お客様に喜ばれるでしょう!

5
2
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?