==エラトステネスのふるい==
[[VC++.NET]]{{category ロジック}}
using namespace System;
static void screenNumber(array<<bool>>^ args) {
args[0] = true;
args[1] = true;
for (int i=2; i < < args->>Length; i++) { for (int j=2; j < < args->>Length; j++) {
int num = i * j;
if (num >>= args->>Length) {
break;
}
}
static void print(array<<bool>>^ ary) {
int itemCnt = 0;
for (int i=0; i < < ary->>Length; i++) {
if (!ary[i]) {
Console::Write("{0,6:d} {1}", i, ((++itemCnt % 6 == 0)?"\n":""));
}
int main(array<<System::String ^> > ^args)
{
int size = 0l;
array<<bool>>^ ary = nullptr;
try {
size = Int32::Parse(args[0]);
ary = gcnew array<<bool>>(size);
} catch (Exception^ e) {
Console::WriteLine("引数が不正です\n{0}", e);