#2
by あたっしゅ » 4年前
東上☆海美「
書いてみたみみ。
コード:
//
// Console .NET CORE App.
//
// https://dixq.net/forum/viewtopic.php?f=3&t=21156&sid=a244b28553ad7d7598b97c892abd7234
// 記号を多次元配列でランダムに表示する - ミクプラ(ja)
//
using System;
namespace CsConsoleApp_2021R03_05_10
{
class Program
{
static void Main(string[] args)
{
string[] a = new string[2] { "〇|", "●|" };
Random r1 = new System.Random();
int[,] map = new int[8, 8];
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 8; i++)
{
map[j,i] = r1.Next(0, 2);
}
}
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 8; i++)
{
int r2 = r1.Next(0, 2);
Console.Write(a[map[j,i]]);
}
Console.Write("\n");
Console.Write("--+--+--+--+--+--+--+--+\n");
}
}
}
}
// end.
」
東上☆海美「
書いてみたみみ。
[code]
//
// Console .NET CORE App.
//
// https://dixq.net/forum/viewtopic.php?f=3&t=21156&sid=a244b28553ad7d7598b97c892abd7234
// 記号を多次元配列でランダムに表示する - ミクプラ(ja)
//
using System;
namespace CsConsoleApp_2021R03_05_10
{
class Program
{
static void Main(string[] args)
{
string[] a = new string[2] { "〇|", "●|" };
Random r1 = new System.Random();
int[,] map = new int[8, 8];
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 8; i++)
{
map[j,i] = r1.Next(0, 2);
}
}
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 8; i++)
{
int r2 = r1.Next(0, 2);
Console.Write(a[map[j,i]]);
}
Console.Write("\n");
Console.Write("--+--+--+--+--+--+--+--+\n");
}
}
}
}
// end.
[/code]
」