stefanocheri / freenet.de wrote:
> Hello,
> 
> how do i write this C++ source code in ruby:
> 
> cout<<"Enter field length: ";
> cin>>Field;

puts "Enter field length"
max = gets # vars starting with capital letters are constants
           # plus, you want to input Max, not Field in your C++ code
	   # anyway

> for(i=0;i<Max;i++)
> {
>  cout<<"Insert "<<i<<". Number:";
>  cin>>Field[i];
> }

field = [] # or field = Array.new
0.upto(max) {|i|
  print "Insert #{i}. Number: " # puts adds a newline; print does not
  field[i] = gets # arrays can be grown dynamically 
}

martin