Newer
Older
Ruby / ti-mu.rb
@WATARAI Hikari WATARAI Hikari on 3 Feb 2023 888 bytes 2023-02-03 22:09:05
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

while true
puts"何をする?
1:公式
2:問題
3:終わる"

a = gets.to_i

if a == 1
  puts"どの公式を見る?"
  zukei = %w(0:正方形 1:長方形 2:平行四辺形 3:円 4:比例 5:反比例 6:一次関数
7:二次関数)

kousiki = %w(一辺✕一辺 縦✕横 底辺✕高さ 半径✕半径✕円周率 y=ax y=a/x y=ax+b y=ax2)
  puts zukei
  puts"どの図形の公式を知りたい?"
  i = gets.to_i
  printf("この図形の公式は%sだよ!\n",kousiki[i])
end
end

elsif a  == 2
  puts"問題!"
  mondai = ["一辺が6cmの正方形の面積は?","縦が4cm、横が9cmの長方形の面積は?","底辺が9cm、高さが4cmの平行四辺形の面積は?","","","","",""]
  l = rand(mondai,8)
  printf("%s\n",mondai[l])
  ll = gets.to_i
  if ll == 36
    puts"正解!!"
  end
end

elsif a == 3
  puts"終わるよ"
end