Created
April 7, 2009 20:20
-
-
Save alexshapalov/91439 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
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 | |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment