概要
cscの作法、調べてみた。
練習問題やってみた。
練習問題
zundokoを、エクセルで出力せよ。
写真
サンプルコード
using System;
using System.Text;
using System.IO;
using System.Data;
using System.Data.Common;
using System.Transactions;
using System.Data.SQLite;
using ClosedXML.Excel;
namespace App
{
class Program {
static void Main(string[] args) {
var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "zun.xlsx");
var wb = new XLWorkbook();
var ws = wb.Worksheets.Add("Sheet1");
int i = 1;
int j = 1;
Random r = new Random();
int b = 0;
do
{
if (r.Next(2) == 0)
{
ws.Cell(i, j).Value = "ズン";
j++;
b++;
}
else
{
ws.Cell(i, j).Value = "ドコ";
j++;
b = 0;
}
} while (b < 4);
ws.Cell(i, j).Value = "ドコ キ・ヨ・シ!";
wb.SaveAs(filePath);
Console.WriteLine("ok");
}
}
}
以上。