WeixiangYan/CodeTransOcean huggingface dataset:
Task: Man or boy test



C#: using System;
 
delegate T Func<T>();
 
class ManOrBoy
{
    static void Main()
    {
        Console.WriteLine(A(10, C(1), C(-1), C(-1), C(1), C(0)));
    }
 
    static Func<int> C(int i)
    {
        return delegate { return i; };
    }
 
    static int A(int k, Func<int> x1, Func<int> x2, Func<int> x3, Func<int> x4, Func<int> x5)
    {
        Func<int> b = null;
        b = delegate { k--; return A(k, b, x1, x2, x3, x4); };
        return k <= 0 ? x4() + x5() : b();
    }
}
Task: Man or boy test


C++: #include <iostream>
#include <tr1/memory>
using std::tr1::shared_ptr;
using std::tr1::enable_shared_from_this;

struct Arg {
  virtual int run() = 0;
  virtual ~Arg() { };
};

int A(int, shared_ptr<Arg>, shared_ptr<Arg>, shared_ptr<Arg>,
      shared_ptr<Arg>, shared_ptr<Arg>);

class B : public Arg, public enable_shared_from_this<B> {
private:
  int k;
  const shared_ptr<Arg> x1, x2, x3, x4;

public:
  B(int _k, shared_ptr<Arg> _x1, shared_ptr<Arg> _x2, shared_ptr<Arg> _x3,
    shared_ptr<Arg> _x4)
    : k(_k), x1(_x1), x2(_x2), x3(_x3), x4(_x4) { }
  int run() {
    return A(--k, shared_from_this(), x1, x2, x3, x4);
  }
};

class Const : public Arg {
private:
  const int x;
public:
  Const(int _x) : x(_x) { }
  int run () { return x; }
};

int A(int k, shared_ptr<Arg> x1, shared_ptr<Arg> x2, shared_ptr<Arg> x3,
      shared_ptr<Arg> x4, shared_ptr<Arg> x5) {
  if (k <= 0)
    return x4->run() + x5->run();
  else {
    shared_ptr<Arg> b(new B(k, x1, x2, x3, x4));
    return b->run();
  }
}

int main() {
  std::cout << A(10, shared_ptr<Arg>(new Const(1)),
                 shared_ptr<Arg>(new Const(-1)),
                 shared_ptr<Arg>(new Const(-1)),
                 shared_ptr<Arg>(new Const(1)),
                 shared_ptr<Arg>(new Const(0))) << std::endl;
  return 0;
}
Task: Man or boy test





Java: import java.util.function.DoubleSupplier;

public class ManOrBoy {
    
    static double A(int k, DoubleSupplier x1, DoubleSupplier x2,
                 DoubleSupplier x3, DoubleSupplier x4, DoubleSupplier x5) {
        
        DoubleSupplier B = new DoubleSupplier() {
            int m = k;
            public double getAsDouble() {
                return A(--m, this, x1, x2, x3, x4);
            }
        };
                
        return k <= 0 ? x4.getAsDouble() + x5.getAsDouble() : B.getAsDouble();
    }
    
    public static void main(String[] args) {
        System.out.println(A(10, () -> 1.0, () -> -1.0, () -> -1.0, () -> 1.0, () -> 0.0));
    }
}
Task: Man or boy test







Python: 
import sys
sys.setrecursionlimit(1025)

def a(in_k, x1, x2, x3, x4, x5):
    k = [in_k]
    def b():
        k[0] -= 1
        return a(k[0], b, x1, x2, x3, x4)
    return x4() + x5() if k[0] <= 0 else b()

x = lambda i: lambda: i
print(a(10, x(1), x(-1), x(-1), x(1), x(0)))
Task: Man or boy test




Go: package main
import "fmt"

func a(k int, x1, x2, x3, x4, x5 func() int) int {
	var b func() int
	b = func() int {
		k--
		return a(k, b, x1, x2, x3, x4)
	}
	if k <= 0 {
		return x4() + x5()
	}
	return b()
}

func main() {
	x := func(i int) func() int { return func() int { return i } }
	fmt.Println(a(10, x(1), x(-1), x(-1), x(1), x(0)))
}
Task: Man or boy test



C#: using System;
 
delegate T Func<T>();
 
class ManOrBoy
{
    static void Main()
    {
        Console.WriteLine(A(10, C(1), C(-1), C(-1), C(1), C(0)));
    }
 
    static Func<int> C(int i)
    {
        return delegate { return i; };
    }
 
    static int A(int k, Func<int> x1, Func<int> x2, Func<int> x3, Func<int> x4, Func<int> x5)
    {
        Func<int> b = null;
        b = delegate { k--; return A(k, b, x1, x2, x3, x4); };
        return k <= 0 ? x4() + x5() : b();
    }
}








Fortran: module man_or_boy

implicit none

contains

  recursive integer function A(k,x1,x2,x3,x4,x5) result(res)
    integer, intent(in) :: k
    interface
      recursive integer function x1()
      end function
      recursive integer function x2()
      end function
      recursive integer function x3()
      end function
      recursive integer function x4()
      end function
      recursive integer function x5()
      end function
    end interface
    integer :: m
    if ( k <= 0 ) then
      res = x4()+x5()
    else
      m = k
      res = B()
    end if
  
  contains
  
    recursive integer function B() result(res)    
      m = m-1
      res = A(m,B,x1,x2,x3,x4)
    end function B
  
  end function A


  recursive integer function one() result(res)
    res = 1
  end function

  recursive integer function minus_one() result(res)
    res = -1
  end function

  recursive integer function zero() result(res)
    res = 0
  end function

end module man_or_boy

program test
  use man_or_boy
  write (*,*) A(10,one,minus_one,minus_one,one,zero)
end program test
Task: Man or boy test


C++: #include <iostream>
#include <tr1/memory>
using std::tr1::shared_ptr;
using std::tr1::enable_shared_from_this;

struct Arg {
  virtual int run() = 0;
  virtual ~Arg() { };
};

int A(int, shared_ptr<Arg>, shared_ptr<Arg>, shared_ptr<Arg>,
      shared_ptr<Arg>, shared_ptr<Arg>);

class B : public Arg, public enable_shared_from_this<B> {
private:
  int k;
  const shared_ptr<Arg> x1, x2, x3, x4;

public:
  B(int _k, shared_ptr<Arg> _x1, shared_ptr<Arg> _x2, shared_ptr<Arg> _x3,
    shared_ptr<Arg> _x4)
    : k(_k), x1(_x1), x2(_x2), x3(_x3), x4(_x4) { }
  int run() {
    return A(--k, shared_from_this(), x1, x2, x3, x4);
  }
};

class Const : public Arg {
private:
  const int x;
public:
  Const(int _x) : x(_x) { }
  int run () { return x; }
};

int A(int k, shared_ptr<Arg> x1, shared_ptr<Arg> x2, shared_ptr<Arg> x3,
      shared_ptr<Arg> x4, shared_ptr<Arg> x5) {
  if (k <= 0)
    return x4->run() + x5->run();
  else {
    shared_ptr<Arg> b(new B(k, x1, x2, x3, x4));
    return b->run();
  }
}

int main() {
  std::cout << A(10, shared_ptr<Arg>(new Const(1)),
                 shared_ptr<Arg>(new Const(-1)),
                 shared_ptr<Arg>(new Const(-1)),
                 shared_ptr<Arg>(new Const(1)),
                 shared_ptr<Arg>(new Const(0))) << std::endl;
  return 0;
}









Fortran: module man_or_boy

implicit none

contains

  recursive integer function A(k,x1,x2,x3,x4,x5) result(res)
    integer, intent(in) :: k
    interface
      recursive integer function x1()
      end function
      recursive integer function x2()
      end function
      recursive integer function x3()
      end function
      recursive integer function x4()
      end function
      recursive integer function x5()
      end function
    end interface
    integer :: m
    if ( k <= 0 ) then
      res = x4()+x5()
    else
      m = k
      res = B()
    end if
  
  contains
  
    recursive integer function B() result(res)    
      m = m-1
      res = A(m,B,x1,x2,x3,x4)
    end function B
  
  end function A


  recursive integer function one() result(res)
    res = 1
  end function

  recursive integer function minus_one() result(res)
    res = -1
  end function

  recursive integer function zero() result(res)
    res = 0
  end function

end module man_or_boy

program test
  use man_or_boy
  write (*,*) A(10,one,minus_one,minus_one,one,zero)
end program test
Task: Man or boy test

C: 
#include <stdio.h>
#include <stdlib.h>


typedef struct arg
{
  int       (*fn)(struct arg*);
  int        *k;
  struct arg *x1, *x2, *x3, *x4, *x5;
} ARG;


int f_1 (ARG* _) { return -1; }
int f0  (ARG* _) { return  0; }
int f1  (ARG* _) { return  1; }


int eval(ARG* a) { return a->fn(a); }
#define MAKE_ARG(...) (&(ARG){__VA_ARGS__})
#define FUN(...) MAKE_ARG(B, &k, __VA_ARGS__)

int A(ARG*);


int B(ARG* a)
{
  int k = *a->k -= 1;
  return A(FUN(a, a->x1, a->x2, a->x3, a->x4));
}

int A(ARG* a)
{
  return *a->k <= 0 ? eval(a->x4) + eval(a->x5) : B(a);
}

int main(int argc, char **argv)
{
  int k = argc == 2 ? strtol(argv[1], 0, 0) : 10;
  printf("%d\n", A(FUN(MAKE_ARG(f1), MAKE_ARG(f_1), MAKE_ARG(f_1),
                       MAKE_ARG(f1), MAKE_ARG(f0))));
  return 0;
}










Fortran: module man_or_boy

implicit none

contains

  recursive integer function A(k,x1,x2,x3,x4,x5) result(res)
    integer, intent(in) :: k
    interface
      recursive integer function x1()
      end function
      recursive integer function x2()
      end function
      recursive integer function x3()
      end function
      recursive integer function x4()
      end function
      recursive integer function x5()
      end function
    end interface
    integer :: m
    if ( k <= 0 ) then
      res = x4()+x5()
    else
      m = k
      res = B()
    end if
  
  contains
  
    recursive integer function B() result(res)    
      m = m-1
      res = A(m,B,x1,x2,x3,x4)
    end function B
  
  end function A


  recursive integer function one() result(res)
    res = 1
  end function

  recursive integer function minus_one() result(res)
    res = -1
  end function

  recursive integer function zero() result(res)
    res = 0
  end function

end module man_or_boy

program test
  use man_or_boy
  write (*,*) A(10,one,minus_one,minus_one,one,zero)
end program test
Task: Man or boy test





Java: import java.util.function.DoubleSupplier;

public class ManOrBoy {
    
    static double A(int k, DoubleSupplier x1, DoubleSupplier x2,
                 DoubleSupplier x3, DoubleSupplier x4, DoubleSupplier x5) {
        
        DoubleSupplier B = new DoubleSupplier() {
            int m = k;
            public double getAsDouble() {
                return A(--m, this, x1, x2, x3, x4);
            }
        };
                
        return k <= 0 ? x4.getAsDouble() + x5.getAsDouble() : B.getAsDouble();
    }
    
    public static void main(String[] args) {
        System.out.println(A(10, () -> 1.0, () -> -1.0, () -> -1.0, () -> 1.0, () -> 0.0));
    }
}






Fortran: module man_or_boy

implicit none

contains

  recursive integer function A(k,x1,x2,x3,x4,x5) result(res)
    integer, intent(in) :: k
    interface
      recursive integer function x1()
      end function
      recursive integer function x2()
      end function
      recursive integer function x3()
      end function
      recursive integer function x4()
      end function
      recursive integer function x5()
      end function
    end interface
    integer :: m
    if ( k <= 0 ) then
      res = x4()+x5()
    else
      m = k
      res = B()
    end if
  
  contains
  
    recursive integer function B() result(res)    
      m = m-1
      res = A(m,B,x1,x2,x3,x4)
    end function B
  
  end function A


  recursive integer function one() result(res)
    res = 1
  end function

  recursive integer function minus_one() result(res)
    res = -1
  end function

  recursive integer function zero() result(res)
    res = 0
  end function

end module man_or_boy

program test
  use man_or_boy
  write (*,*) A(10,one,minus_one,minus_one,one,zero)
end program test
Task: Man or boy test







Python: 
import sys
sys.setrecursionlimit(1025)

def a(in_k, x1, x2, x3, x4, x5):
    k = [in_k]
    def b():
        k[0] -= 1
        return a(k[0], b, x1, x2, x3, x4)
    return x4() + x5() if k[0] <= 0 else b()

x = lambda i: lambda: i
print(a(10, x(1), x(-1), x(-1), x(1), x(0)))




Fortran: module man_or_boy

implicit none

contains

  recursive integer function A(k,x1,x2,x3,x4,x5) result(res)
    integer, intent(in) :: k
    interface
      recursive integer function x1()
      end function
      recursive integer function x2()
      end function
      recursive integer function x3()
      end function
      recursive integer function x4()
      end function
      recursive integer function x5()
      end function
    end interface
    integer :: m
    if ( k <= 0 ) then
      res = x4()+x5()
    else
      m = k
      res = B()
    end if
  
  contains
  
    recursive integer function B() result(res)    
      m = m-1
      res = A(m,B,x1,x2,x3,x4)
    end function B
  
  end function A


  recursive integer function one() result(res)
    res = 1
  end function

  recursive integer function minus_one() result(res)
    res = -1
  end function

  recursive integer function zero() result(res)
    res = 0
  end function

end module man_or_boy

program test
  use man_or_boy
  write (*,*) A(10,one,minus_one,minus_one,one,zero)
end program test
Task: Man or boy test






PHP: <?php
function A($k,$x1,$x2,$x3,$x4,$x5) {
    $b = function () use (&$b,&$k,$x1,$x2,$x3,$x4) {
        return A(--$k,$b,$x1,$x2,$x3,$x4);
    };
    return $k <= 0 ? $x4() + $x5() : $b();
}  

echo A(10, function () { return  1; },
           function () { return -1; },
           function () { return -1; },
           function () { return  1; }, 
           function () { return  0; }) . "\n";
?>





Fortran: module man_or_boy

implicit none

contains

  recursive integer function A(k,x1,x2,x3,x4,x5) result(res)
    integer, intent(in) :: k
    interface
      recursive integer function x1()
      end function
      recursive integer function x2()
      end function
      recursive integer function x3()
      end function
      recursive integer function x4()
      end function
      recursive integer function x5()
      end function
    end interface
    integer :: m
    if ( k <= 0 ) then
      res = x4()+x5()
    else
      m = k
      res = B()
    end if
  
  contains
  
    recursive integer function B() result(res)    
      m = m-1
      res = A(m,B,x1,x2,x3,x4)
    end function B
  
  end function A


  recursive integer function one() result(res)
    res = 1
  end function

  recursive integer function minus_one() result(res)
    res = -1
  end function

  recursive integer function zero() result(res)
    res = 0
  end function

end module man_or_boy

program test
  use man_or_boy
  write (*,*) A(10,one,minus_one,minus_one,one,zero)
end program test
Task: Man or boy test






PHP: <?php
function A($k,$x1,$x2,$x3,$x4,$x5) {
    $b = function () use (&$b,&$k,$x1,$x2,$x3,$x4) {
        return A(--$k,$b,$x1,$x2,$x3,$x4);
    };
    return $k <= 0 ? $x4() + $x5() : $b();
}  

echo A(10, function () { return  1; },
           function () { return -1; },
           function () { return -1; },
           function () { return  1; }, 
           function () { return  0; }) . "\n";
?>
Task: Man or boy test






PHP: <?php
function A($k,$x1,$x2,$x3,$x4,$x5) {
    $b = function () use (&$b,&$k,$x1,$x2,$x3,$x4) {
        return A(--$k,$b,$x1,$x2,$x3,$x4);
    };
    return $k <= 0 ? $x4() + $x5() : $b();
}  

echo A(10, function () { return  1; },
           function () { return -1; },
           function () { return -1; },
           function () { return  1; }, 
           function () { return  0; }) . "\n";
?>






Ada: with Ada.Text_IO;  use Ada.Text_IO;

procedure Man_Or_Boy is
   function Zero return Integer is begin return  0; end Zero;
   function One return Integer  is begin return  1; end One;
   function Neg return Integer  is begin return -1; end Neg;

   function A
            (  K : Integer;
               X1, X2, X3, X4, X5 : access function return Integer
            )  return Integer is
      M : Integer := K; 
      function B return Integer is
      begin
         M := M - 1;
         return A (M, B'Access, X1, X2, X3, X4);
      end B;
   begin
      if M <= 0 then
         return X4.all + X5.all;
      else
         return B;
      end if;
   end A;
begin
   Put_Line
   (  Integer'Image
       (  A
          (  10,
             One'Access, 
             Neg'Access, 
             Neg'Access, 
             One'Access, 
             Zero'Access 
   )  )  );
end Man_Or_Boy;
Task: Assertions



C#: using System.Diagnostics; 

static class Program
{
    static void Main()
    {
        int a = 0;

        Console.WriteLine("Before");

        
        Trace.Assert(a == 42, "Trace assertion failed");

        Console.WriteLine("After Trace.Assert");

        
        Debug.Assert(a == 42, "Debug assertion failed");

        Console.WriteLine("After Debug.Assert");
    }
}









Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions

C: #include <assert.h>

int main(){
   int a;
   
   assert(a == 42); 

   return 0;
}











Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions


C++: #include <cassert> 

int main()
{
  int a;
  

  assert(a == 42); 
                    
}










Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions




Go: package main

func main() {
    x := 43
    if x != 42 {
        panic(42)
    }
}








Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions





Java: public class Assertions {

    public static void main(String[] args) {
        int a = 13;

        

        assert a == 42;
        

        assert a == 42 : "Error message";
        
        
        
    }
}







Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions







Python: a = 5

assert a == 42 
assert a == 42, "Error message" 
       
       





Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions








VB: Imports System.Diagnostics



Module Program
    Sub Main()
        Dim a As Integer = 0

        Console.WriteLine("Before")

        
        Trace.Assert(a = 42, "Trace assertion failed: The Answer was incorrect")

        Console.WriteLine("After Trace.Assert")

        
        Debug.Assert(a = 42, "Debug assertion failed: The Answer was incorrect")

        Console.WriteLine("After Debug.Assert")
    End Sub
End Module




Ada: pragma Assert (A = 42, "Oops!");
Task: Assertions

C: #include <assert.h>

int main(){
   int a;
   
   assert(a == 42); 

   return 0;
}
Task: Assertions



C#: using System.Diagnostics; 

static class Program
{
    static void Main()
    {
        int a = 0;

        Console.WriteLine("Before");

        
        Trace.Assert(a == 42, "Trace assertion failed");

        Console.WriteLine("After Trace.Assert");

        
        Debug.Assert(a == 42, "Debug assertion failed");

        Console.WriteLine("After Debug.Assert");
    }
}
Task: Assertions


C++: #include <cassert> 

int main()
{
  int a;
  

  assert(a == 42); 
                    
}
Task: Assertions





Java: public class Assertions {

    public static void main(String[] args) {
        int a = 13;

        

        assert a == 42;
        

        assert a == 42 : "Error message";
        
        
        
    }
}
Task: Assertions








VB: Imports System.Diagnostics



Module Program
    Sub Main()
        Dim a As Integer = 0

        Console.WriteLine("Before")

        
        Trace.Assert(a = 42, "Trace assertion failed: The Answer was incorrect")

        Console.WriteLine("After Trace.Assert")

        
        Debug.Assert(a = 42, "Debug assertion failed: The Answer was incorrect")

        Console.WriteLine("After Debug.Assert")
    End Sub
End Module
Task: Assertions




Go: package main

func main() {
    x := 43
    if x != 42 {
        panic(42)
    }
}
Task: Assertions







Python: a = 5

assert a == 42 
assert a == 42, "Error message"
Task: Assertions






PHP: <?php
$a = 5
#...input or change $a here
assert($a == 42) # when $a is not 42, take appropriate actions,
                 # which is set by assert_options()
?>
Task: Assertions






PHP: <?php
$a = 5
#...input or change $a here
assert($a == 42) # when $a is not 42, take appropriate actions,
                 # which is set by assert_options()
?>






Ada: pragma Assert (A = 42, "Oops!");
Task: Collections



C#: 
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };

int[] intArray = new int[]{ 1, 2, 3, 4, 5 };

int[] intArray = { 1, 2, 3, 4, 5 };


string[] stringArr = new string[5];
stringArr[0] = "string";









Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections

C: #define cSize( a )  ( sizeof(a)/sizeof(a[0]) ) 
int ar[10];               
ar[0] = 1;                
ar[1] = 2;

int* p;                   
for (p=ar;                
       p<(ar+cSize(ar));  
       p++) {             
  printf("%d\n",*p);      
}                         











Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections


C++: int a[5]; 
a[0] = 1; 

int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 }; 

#include <string>
std::string strings[4]; 
                        










Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections




Go: package main

import "fmt"

func main() {
    var a []interface{}
    a = append(a, 3)
    a = append(a, "apples", "oranges")
    fmt.Println(a)
}








Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections





Java: List arrayList = new ArrayList();
arrayList.add(new Integer(0));

arrayList.add(0); 



List<Integer> myarrlist = new ArrayList<Integer>();


int sum;
for(int i = 0; i < 10; i++) {
    myarrlist.add(i);
}







Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections







Python: collection = [0, '1']                 
x = collection[0]                     
collection.append(2)                  
collection.insert(0, '-1')            
y = collection[0]                     
collection.extend([2,'3'])            
collection += [2,'3']                 
collection[2:6]                       
len(collection)                       
collection = (0, 1)                   
collection[:]                         
collection[-4:-1]                     
collection[::2]                       
collection="some string"              
x = collection[::-1]                  
collection[::2] == "some string"[::2] 
collection.__getitem__(slice(0,len(collection),2))  
collection = {0: "zero", 1: "one"}    
collection['zero'] = 2                
collection = set([0, '1'])            





Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections








VB: Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"




Ada: procedure Array_Collection is

   A : array (-3 .. -1) of Integer := (1, 2, 3);
   
begin
   
   A (-3) := 3;
   A (-2) := 2;
   A (-1) := 1;
   
end Array_Collection;
Task: Collections

C: #define cSize( a )  ( sizeof(a)/sizeof(a[0]) ) 
int ar[10];               
ar[0] = 1;                
ar[1] = 2;

int* p;                   
for (p=ar;                
       p<(ar+cSize(ar));  
       p++) {             
  printf("%d\n",*p);      
}
Task: Collections



C#: 
int[] intArray = new int[5] { 1, 2, 3, 4, 5 };

int[] intArray = new int[]{ 1, 2, 3, 4, 5 };

int[] intArray = { 1, 2, 3, 4, 5 };


string[] stringArr = new string[5];
stringArr[0] = "string";
Task: Collections


C++: int a[5]; 
a[0] = 1; 

int primes[10] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 }; 

#include <string>
std::string strings[4];
Task: Collections





Java: List arrayList = new ArrayList();
arrayList.add(new Integer(0));

arrayList.add(0); 



List<Integer> myarrlist = new ArrayList<Integer>();


int sum;
for(int i = 0; i < 10; i++) {
    myarrlist.add(i);
}
Task: Collections







Python: collection = [0, '1']                 
x = collection[0]                     
collection.append(2)                  
collection.insert(0, '-1')            
y = collection[0]                     
collection.extend([2,'3'])            
collection += [2,'3']                 
collection[2:6]                       
len(collection)                       
collection = (0, 1)                   
collection[:]                         
collection[-4:-1]                     
collection[::2]                       
collection="some string"              
x = collection[::-1]                  
collection[::2] == "some string"[::2] 
collection.__getitem__(slice(0,len(collection),2))  
collection = {0: "zero", 1: "one"}    
collection['zero'] = 2                
collection = set([0, '1'])
Task: Collections








VB: Dim coll As New Collection
coll.Add "apple"
coll.Add "banana"