Newer
Older
Ruby / eigo.rb
@SATO Kenjiro SATO Kenjiro on 13 Dec 2022 2 KB 2022-12-13 20:12:44
# coding: utf-8

require 'csv'
i = CSV.read("英単語1.csv", :headers => true)

while true
print(<<~home)
メニュー
1.英単語の確認 2.確認テスト 0.終了
home
menu = gets.chomp
if menu == "0"
  break
elsif menu == "1"
  print(<<~tangen)
単元
1.Unit1 2.Unit2 3.Unit3 4.Unit4 5.Unit5 6.Unit6 7.Unit7 8.Unit8 9.Unit9
tangen
  tangen = gets.chomp
  if tangen == "1"
  puts"call/〜を呼ぶ"
  gets
  puts"often/しばしば"
  gets
  puts"Australia/オーストラリア"
  gets
  puts"call me〜/私を〜と呼んでください"
  gets
  puts"so/(接)だから(副)とても、そのように"
  gets
  puts"fan/ファン"
  gets
  puts"cricket/クリケット"
  gets
  puts"just/ほんの、ちょうど"
  gets
  puts"How about・・・?/・・・についてどう思いますか"
  gets
  puts"there/そこで"
  gets
  puts"every/毎・・・、・・・ごと"
  gets
  puts"but/しかし"
  gets
  puts"Me,too./私も"
  gets
  puts"Thank you/ありがとう"
  gets
  puts"a little/少し"
  gets
  puts"every day/毎日"
  gets
  end
elsif menu == "2"
    puts"確認テストをします。英語の綴りを正しく入れてください。"
    correct = 0
    total = 0
    while total < 5
      s = rand(i.length)
      printf("%s\n",i[s])
    if i == 1
      total += 1
      cal = gets.chomp
      cal == "call"
      correct += 1
    elsif i == 2
      total += 1
      ofte = gets.chomp
      ofte == "often"
      correct += 1
    elsif i == 3
      total += 1
      aust = gets.chomp
      aust == "Australia"
      correct += 1
    elsif i == 4
      total += 1
      callm = gets.chomp
      callm == "call me"
      correct += 1
    elsif i == 5
      total += 1
      s = gets.chomp
      s == "so"
      correct += 1
    elsif i == 6
      total += 1
      fa = gets.chomp
      fa == "fan"
      correct += 1
    elsif i == 7
       total += 1
       cri  =  gets.chomp
       cri == "cricket"
      correct += 1
    elsif i == 8
       total += 1
       ju = gets.chomp
       ju == "just"
      correct += 1
    elsif i == 9
       total += 1
       lit = gets.chomp
       lit == "a little"
      correct += 1
    elsif i == 10
       total += 1
       ev = gets.chomp
       ev == "every"
      correct += 1
    elsif i == 11
       total += 1
       ba = gets.chomp
       ba == "bad"
      correct += 1
    elsif i == 12
       total += 1
       me = gets.chomp
       me =="Me too"
      correct += 1
    elsif i == 13
       total += 1
       th = gets.chomp
       th == "Thank you"
      correct += 1
    elsif i == 14
       total += 1
       the = gets.chomp
       the == "there"
      correct += 1
    elsif i == 15
       total += 1
       day = gets.chomp
       day == "every day"
       correct += 1
    elsif i == 16
      total += 1
      how = gets,chomp
      how == "How about ・・・?"
      correct += 1
    end
    end
      printf("%d点\n",correct)
end
end