Created
October 19, 2014 20:56
-
-
Save us113021/d0eb45a10763956f7ab9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
# F:/imlab/座席表作成プログラム/zaseki_dummy.csv | |
# G:/imlab/座席表作成プログラム/zasekihyou.txt | |
require 'csv' | |
require 'pp' | |
##### CSVファイルの読み込み ##### | |
dates = CSV.read("G:/imlab/座席表作成プログラム/zaseki_dummy.csv") | |
puts ("########## データの表示 ##########") | |
pp dates | |
##### 座席順に配列に収納 ##### | |
zaseki = Array.new(121,nil) | |
cnt = 1 | |
for j in 1..10 do | |
for i in 1..12 do | |
g = 0 | |
until dates[g][2].to_i==j && dates[g][3].to_i==i | |
g = g + 1 | |
end | |
zaseki[cnt] = dates[g][1] | |
cnt = cnt + 1 | |
end | |
end | |
#p zaseki | |
##### 簡易座席の表示 ##### | |
puts ("########## 座席表 ##########") | |
cnt = 0 | |
for j in 1..10 do | |
for i in 1..12 do | |
print ("|\t#{zaseki[cnt+i]}\t") | |
end | |
print ("|\n") | |
cnt = cnt +12 | |
end | |
##### txt出力 ##### | |
File.open("G:/imlab/座席表作成プログラム/zasekihyou.txt", "w") do |io| | |
cnt = 0 | |
for j in 1..10 do | |
for i in 1..12 do | |
io.print ("|\t#{zaseki[cnt+i]}\t") | |
end | |
io.print ("|\n") | |
cnt = cnt +12 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment