class Softset attr_accessor :item, :rekod def initialize(item, rekod) @item = item @rekod = rekod end end dataset=[] f= File.new(ARGV[0], "r") linecounter=1; while !f.eof? line=f.gets line = line.split(/\s+/) (line.length).times do |i| dataset.push(Softset.new(i.to_s+line[i],linecounter)) end linecounter += 1 end ss = Hash.new dataset.each do |a| ss[a.item] ||= [] ss[a.item]<< a.rekod end p ss |
ohh Sorry! Terspeaking London pulak!
dan ini input dan outputnya
phd proj guna ruby?
ReplyDeletep.s dah ada blog baru :p
yup,
ReplyDeletedan yup, dah gi lawat ari tu!
congrat!