Skip to content

Instantly share code, notes, and snippets.

@alexshapalov
Created April 7, 2009 20:20
Show Gist options
  • Save alexshapalov/91439 to your computer and use it in GitHub Desktop.
Save alexshapalov/91439 to your computer and use it in GitHub Desktop.
require "mathn"
class Matt
def initialize(a,b)
@a,@b = a,b
end
def matrixa(a)
puts "Vvedit matrix a "
@a=Matrix[[1, 1, 1], [1, 1, 1], [1, 1, 1]]
#@a = gets.strip.split(" ").map{|s| s.split("x").map{|i| i.to_i} }
#Matrix[ *@a ]
p @a
end
def matrixb(b)
puts "Vvedit matrix b "
@b=Matrix[[3, 3, 3], [3, 3, 3], [3, 3, 3]]
#@b = gets.strip.split(" ").map{|s| s.split("x").map{|i| i.to_i} }
#Matrix[ *@b ]
p @b
end
def viraz
puts "Vedit znak 1=+ 2=-"
m=gets.to_i
if m == 1
puts @a+@b
else
puts @a-@b
end
end
end
rezultat = Matt.new(@a,@b)
rezultat.matrixa(@a)
rezultat.matrixb(@b)
rezultat.viraz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment