WeixiangYan/CodeTransOcean huggingface dataset:
Task: Bacon cipher




Go: package main

import(
    "fmt"
    "strings"
)

var codes = map[rune]string {
    'a' : "AAAAA", 'b' : "AAAAB", 'c' : "AAABA", 'd' : "AAABB", 'e' : "AABAA",
    'f' : "AABAB", 'g' : "AABBA", 'h' : "AABBB", 'i' : "ABAAA", 'j' : "ABAAB",
    'k' : "ABABA", 'l' : "ABABB", 'm' : "ABBAA", 'n' : "ABBAB", 'o' : "ABBBA",
    'p' : "ABBBB", 'q' : "BAAAA", 'r' : "BAAAB", 's' : "BAABA", 't' : "BAABB",
    'u' : "BABAA", 'v' : "BABAB", 'w' : "BABBA", 'x' : "BABBB", 'y' : "BBAAA",
    'z' : "BBAAB", ' ' : "BBBAA",  
}

func baconEncode(plainText string, message string) string {
    pt := strings.ToLower(plainText)
    var sb []byte
    for _, c := range pt {
        if c >= 'a' && c <= 'z' {
            sb = append(sb, codes[c]...)
        } else {
            sb = append(sb, codes[' ']...)
        }
    }
    et := string(sb)
    mg := strings.ToLower(message)  
    sb = nil  
    var count = 0
    for _, c := range mg {
        if c >= 'a' && c <= 'z' {
            if et[count] == 'A' {
                sb = append(sb, byte(c))
            } else {
                sb = append(sb, byte(c - 32))  
            }
            count++
            if count == len(et) { break }
        } else {
            sb = append(sb, byte(c))
        }
    }
    return string(sb)
}

func baconDecode(message string) string {
    var sb []byte
    for _, c := range message {
        if c >= 'a' && c <= 'z' {
            sb = append(sb, 'A')
        } else if c >= 'A' && c <= 'Z' {
            sb = append(sb, 'B')
        }
    }
    et := string(sb)
    sb = nil  
    for i := 0; i < len(et); i += 5 {
        quintet := et[i : i + 5]
        for k, v := range codes {
            if v == quintet {
                sb = append(sb, byte(k))
                break
            }
        }
    }
    return string(sb)
} 

func main() {
    plainText := "the quick brown fox jumps over the lazy dog"
    message := "bacon's cipher is a method of steganography created by francis bacon." +
        "this task is to implement a program for encryption and decryption of " +
        "plaintext using the simple alphabet of the baconian cipher or some " +
        "other kind of representation of this alphabet (make anything signify anything). " +
        "the baconian alphabet may optionally be extended to encode all lower " +
        "case characters individually and/or adding a few punctuation characters " +
        "such as the space."
    cipherText := baconEncode(plainText, message)
    fmt.Printf("Cipher text ->\n\n%s\n", cipherText)
    decodedText := baconDecode(cipherText)
    fmt.Printf("\nHidden text ->\n\n%s\n", decodedText)
}
Task: Constrained random points on a circle

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

inline
int randn(int m)
{
	int rand_max = RAND_MAX - (RAND_MAX % m);
	int r;
	while ((r = rand()) > rand_max);
	return r / (rand_max / m);
}

int main()
{
	int i, x, y, r2;
	unsigned long buf[31] = {0}; 

	for (i = 0; i < 100; ) {
		x = randn(31) - 15;
		y = randn(31) - 15;
		r2 = x * x + y * y;
		if (r2 >= 100 && r2 <= 225) {
			buf[15 + y] |= 1 << (x + 15);
			i++;
		}
	}

	for (y = 0; y < 31; y++) {
		for (x = 0; x < 31; x++)
			printf((buf[y] & 1 << x) ? ". " : "  ");
		printf("\n");
	}

	return 0;
}
Task: Constrained random points on a circle



C#: using System;
using System.Diagnostics;
using System.Drawing;

namespace RosettaConstrainedRandomCircle
{
    class Program
    {
        static void Main(string[] args)
        {
            var points = new Point[404];
            int i = 0;
            for (int y = -15; y <= 15; y++)
                for (int x = -15; x <= 15 && i < 404; x++)
                {
                    var c = Math.Sqrt(x * x + y * y);
                    if (10 <= c && c <= 15)
                    {
                        points[i++] = new Point(x, y);
                    }
                }

            var bm = new Bitmap(600, 600);
            var g = Graphics.FromImage(bm);
            var brush = new SolidBrush(Color.Magenta);

            var r = new System.Random();
            for (int count = 0; count < 100; count++)
            {
                var p = points[r.Next(404)];
                g.FillEllipse(brush, new Rectangle(290 + 19 * p.X, 290 + 19 * p.Y, 10, 10));
            }
            const string filename = "Constrained Random Circle.png";
            bm.Save(filename);
            Process.Start(filename);
        }
    }
}
Task: Constrained random points on a circle


C++: #include <windows.h>
#include <list>
#include <iostream>


using namespace std;


class point
{
public:
    int x, y;
    point()                  { x = y = 0; }
    point( int a, int b )    { x = a; y = b; }
    void set( int a, int b ) { x = a; y = b; }
};

class rndCircle
{
public:
    void draw()
    {
	createPoints();
	drawPoints();
    }

private:
    void createPoints()
    {
	point pt;
	for( int x = 0; x < 200; x++ )
	{
	    int a, b, c;
	    while( true )
	    {
		a = rand() % 31 - 15;
		b = rand() % 31 - 15;
		c = a * a + b * b;
		if( c >= 100 && c <= 225 ) break;
	    }
	    pt.set( a, b );
	    _ptList.push_back( pt );
	}
    }

    void drawPoints()
    {
	HDC dc = GetDC( GetConsoleWindow() );
	for( list<point>::iterator it = _ptList.begin(); it != _ptList.end(); it++ )
	    SetPixel( dc, 300 + 10 * ( *it ).x, 300 + 10 * ( *it ).y, RGB( 255, 255, 0 ) );
    }

    list<point> _ptList;
};

int main( int argc, char* argv[] )
{
    ShowWindow( GetConsoleWindow(), SW_MAXIMIZE );
    srand( GetTickCount() );
    rndCircle c;
    c.draw();
    system( "pause" );
    return 0;
}
Task: Constrained random points on a circle





Java: import java.util.Random;

public class FuzzyCircle {
	static final Random rnd = new Random();
	public static void main(String[] args){
		char[][] field = new char[31][31];
		for(int i = 0; i < field.length; i++){
			for(int j = 0; j < field[i].length; j++){
				field[i][j] = ' ';
			}
		}
		int pointsInDisc = 0;
		while(pointsInDisc < 100){
			int x = rnd.nextInt(31) - 15;
			int y = rnd.nextInt(31) - 15;
			double dist = Math.hypot(x, y);
			if(dist >= 10 && dist <= 15 && field[x + 15][y + 15] == ' '){
				field[x + 15][y + 15] = 'X';
				pointsInDisc++;
			}
		}
		for(char[] row:field){
			for(char space:row){
				System.out.print(space);
			}
			System.out.println();
		}
	}
}
Task: Constrained random points on a circle







Python: >>> from collections import defaultdict
>>> from random import choice
>>> world = defaultdict(int)
>>> possiblepoints = [(x,y) for x in range(-15,16)
		  for y in range(-15,16)
		  if 10 <= abs(x+y*1j) <= 15]
>>> for i in range(100): world[choice(possiblepoints)] += 1

>>> for x in range(-15,16):
	print(''.join(str(min([9, world[(x,y)]])) if world[(x,y)] else ' '
			  for y in range(-15,16)))

	
                               
             1     1           
          1 1                  
      11 1     1  1     1      
     111  1     1211           
      1   2    1 1    11       
      1  11         21         
     1   1            11  1    
   1  2                1 1     
                               
 1  2                          
   1 1                      1  
   1 1                         
   2                      11   
  1                         1  
                         1     
                               
                               
  1                          1 
                         1     
                         2     
                            1  
     1                  1 1    
      1                2   1   
   1   3            11  2      
    11   1    1      1   2     
            1   1    2         
        1  1                   
         1      1     1        
          2 2   1              
               1
Task: Constrained random points on a circle




Go: package main

import (
    "bytes"
    "fmt"
    "math/rand"
    "time"
)

const (
    nPts = 100
    rMin = 10
    rMax = 15
)

func main() {
    rand.Seed(time.Now().Unix())
    span := rMax + 1 + rMax
    rows := make([][]byte, span)
    for r := range rows {
        rows[r] = bytes.Repeat([]byte{' '}, span*2)
    }
    u := 0 
    min2 := rMin * rMin
    max2 := rMax * rMax
    for n := 0; n < nPts; {
        x := rand.Intn(span) - rMax
        y := rand.Intn(span) - rMax
        
        rs := x*x + y*y
        if rs < min2 || rs > max2 {
            continue
        }
        n++ 
        r := y + rMax
        c := (x + rMax) * 2
        if rows[r][c] == ' ' {
            rows[r][c] = '*'
            u++
        }
    }
    for _, row := range rows {
        fmt.Println(string(row))
    }
    fmt.Println(u, "unique points")
}
Task: Constrained random points on a circle



C#: using System;
using System.Diagnostics;
using System.Drawing;

namespace RosettaConstrainedRandomCircle
{
    class Program
    {
        static void Main(string[] args)
        {
            var points = new Point[404];
            int i = 0;
            for (int y = -15; y <= 15; y++)
                for (int x = -15; x <= 15 && i < 404; x++)
                {
                    var c = Math.Sqrt(x * x + y * y);
                    if (10 <= c && c <= 15)
                    {
                        points[i++] = new Point(x, y);
                    }
                }

            var bm = new Bitmap(600, 600);
            var g = Graphics.FromImage(bm);
            var brush = new SolidBrush(Color.Magenta);

            var r = new System.Random();
            for (int count = 0; count < 100; count++)
            {
                var p = points[r.Next(404)];
                g.FillEllipse(brush, new Rectangle(290 + 19 * p.X, 290 + 19 * p.Y, 10, 10));
            }
            const string filename = "Constrained Random Circle.png";
            bm.Save(filename);
            Process.Start(filename);
        }
    }
}








Fortran: program Constrained_Points
  implicit none
 
  integer, parameter :: samples = 100
  integer :: i, j, n, randpoint
  real :: r
 
  type points
    integer :: x, y
  end type

  type(points) :: set(500), temp


  n = 0
  do i = -15, 15
    do j = -15, 15
      if(sqrt(real(i*i + j*j)) >= 10.0 .and. sqrt(real(i*i + j*j)) <= 15.0) then
        n = n + 1
        set(n)%x = i
        set(n)%y = j
      end if
    end do
  end do





  call random_seed
  do i = 1, samples
    call random_number(r)
    randpoint = r * (n + 1 - i) + i
    temp = set(i)
    set(i) = set(randpoint)
    set(randpoint) = temp
  end do



  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x > temp%x)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do


  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x == temp%x .and. set(j)%y > temp%y)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do
  

  write(*,"(a,a)", advance="no") repeat(" ", set(1)%y+15), "*"
  do i = 2, samples
    if(set(i)%x == set(i-1)%x) then
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y - set(i-1)%y-1), "*"
    else
      n = set(i)%x - set(i-1)%x
      do j = 1, n
        write(*,*)
      end do
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y+15), "*"
    end if
  end do
 
end program
Task: Constrained random points on a circle


C++: #include <windows.h>
#include <list>
#include <iostream>


using namespace std;


class point
{
public:
    int x, y;
    point()                  { x = y = 0; }
    point( int a, int b )    { x = a; y = b; }
    void set( int a, int b ) { x = a; y = b; }
};

class rndCircle
{
public:
    void draw()
    {
	createPoints();
	drawPoints();
    }

private:
    void createPoints()
    {
	point pt;
	for( int x = 0; x < 200; x++ )
	{
	    int a, b, c;
	    while( true )
	    {
		a = rand() % 31 - 15;
		b = rand() % 31 - 15;
		c = a * a + b * b;
		if( c >= 100 && c <= 225 ) break;
	    }
	    pt.set( a, b );
	    _ptList.push_back( pt );
	}
    }

    void drawPoints()
    {
	HDC dc = GetDC( GetConsoleWindow() );
	for( list<point>::iterator it = _ptList.begin(); it != _ptList.end(); it++ )
	    SetPixel( dc, 300 + 10 * ( *it ).x, 300 + 10 * ( *it ).y, RGB( 255, 255, 0 ) );
    }

    list<point> _ptList;
};

int main( int argc, char* argv[] )
{
    ShowWindow( GetConsoleWindow(), SW_MAXIMIZE );
    srand( GetTickCount() );
    rndCircle c;
    c.draw();
    system( "pause" );
    return 0;
}










Fortran: program Constrained_Points
  implicit none
 
  integer, parameter :: samples = 100
  integer :: i, j, n, randpoint
  real :: r
 
  type points
    integer :: x, y
  end type

  type(points) :: set(500), temp


  n = 0
  do i = -15, 15
    do j = -15, 15
      if(sqrt(real(i*i + j*j)) >= 10.0 .and. sqrt(real(i*i + j*j)) <= 15.0) then
        n = n + 1
        set(n)%x = i
        set(n)%y = j
      end if
    end do
  end do





  call random_seed
  do i = 1, samples
    call random_number(r)
    randpoint = r * (n + 1 - i) + i
    temp = set(i)
    set(i) = set(randpoint)
    set(randpoint) = temp
  end do



  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x > temp%x)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do


  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x == temp%x .and. set(j)%y > temp%y)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do
  

  write(*,"(a,a)", advance="no") repeat(" ", set(1)%y+15), "*"
  do i = 2, samples
    if(set(i)%x == set(i-1)%x) then
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y - set(i-1)%y-1), "*"
    else
      n = set(i)%x - set(i-1)%x
      do j = 1, n
        write(*,*)
      end do
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y+15), "*"
    end if
  end do
 
end program
Task: Constrained random points on a circle

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

inline
int randn(int m)
{
	int rand_max = RAND_MAX - (RAND_MAX % m);
	int r;
	while ((r = rand()) > rand_max);
	return r / (rand_max / m);
}

int main()
{
	int i, x, y, r2;
	unsigned long buf[31] = {0}; 

	for (i = 0; i < 100; ) {
		x = randn(31) - 15;
		y = randn(31) - 15;
		r2 = x * x + y * y;
		if (r2 >= 100 && r2 <= 225) {
			buf[15 + y] |= 1 << (x + 15);
			i++;
		}
	}

	for (y = 0; y < 31; y++) {
		for (x = 0; x < 31; x++)
			printf((buf[y] & 1 << x) ? ". " : "  ");
		printf("\n");
	}

	return 0;
}










Fortran: program Constrained_Points
  implicit none
 
  integer, parameter :: samples = 100
  integer :: i, j, n, randpoint
  real :: r
 
  type points
    integer :: x, y
  end type

  type(points) :: set(500), temp


  n = 0
  do i = -15, 15
    do j = -15, 15
      if(sqrt(real(i*i + j*j)) >= 10.0 .and. sqrt(real(i*i + j*j)) <= 15.0) then
        n = n + 1
        set(n)%x = i
        set(n)%y = j
      end if
    end do
  end do





  call random_seed
  do i = 1, samples
    call random_number(r)
    randpoint = r * (n + 1 - i) + i
    temp = set(i)
    set(i) = set(randpoint)
    set(randpoint) = temp
  end do



  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x > temp%x)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do


  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x == temp%x .and. set(j)%y > temp%y)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do
  

  write(*,"(a,a)", advance="no") repeat(" ", set(1)%y+15), "*"
  do i = 2, samples
    if(set(i)%x == set(i-1)%x) then
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y - set(i-1)%y-1), "*"
    else
      n = set(i)%x - set(i-1)%x
      do j = 1, n
        write(*,*)
      end do
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y+15), "*"
    end if
  end do
 
end program
Task: Constrained random points on a circle




Go: package main

import (
    "bytes"
    "fmt"
    "math/rand"
    "time"
)

const (
    nPts = 100
    rMin = 10
    rMax = 15
)

func main() {
    rand.Seed(time.Now().Unix())
    span := rMax + 1 + rMax
    rows := make([][]byte, span)
    for r := range rows {
        rows[r] = bytes.Repeat([]byte{' '}, span*2)
    }
    u := 0 
    min2 := rMin * rMin
    max2 := rMax * rMax
    for n := 0; n < nPts; {
        x := rand.Intn(span) - rMax
        y := rand.Intn(span) - rMax
        
        rs := x*x + y*y
        if rs < min2 || rs > max2 {
            continue
        }
        n++ 
        r := y + rMax
        c := (x + rMax) * 2
        if rows[r][c] == ' ' {
            rows[r][c] = '*'
            u++
        }
    }
    for _, row := range rows {
        fmt.Println(string(row))
    }
    fmt.Println(u, "unique points")
}







Fortran: program Constrained_Points
  implicit none
 
  integer, parameter :: samples = 100
  integer :: i, j, n, randpoint
  real :: r
 
  type points
    integer :: x, y
  end type

  type(points) :: set(500), temp


  n = 0
  do i = -15, 15
    do j = -15, 15
      if(sqrt(real(i*i + j*j)) >= 10.0 .and. sqrt(real(i*i + j*j)) <= 15.0) then
        n = n + 1
        set(n)%x = i
        set(n)%y = j
      end if
    end do
  end do





  call random_seed
  do i = 1, samples
    call random_number(r)
    randpoint = r * (n + 1 - i) + i
    temp = set(i)
    set(i) = set(randpoint)
    set(randpoint) = temp
  end do



  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x > temp%x)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do


  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x == temp%x .and. set(j)%y > temp%y)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do
  

  write(*,"(a,a)", advance="no") repeat(" ", set(1)%y+15), "*"
  do i = 2, samples
    if(set(i)%x == set(i-1)%x) then
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y - set(i-1)%y-1), "*"
    else
      n = set(i)%x - set(i-1)%x
      do j = 1, n
        write(*,*)
      end do
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y+15), "*"
    end if
  end do
 
end program
Task: Constrained random points on a circle





Java: import java.util.Random;

public class FuzzyCircle {
	static final Random rnd = new Random();
	public static void main(String[] args){
		char[][] field = new char[31][31];
		for(int i = 0; i < field.length; i++){
			for(int j = 0; j < field[i].length; j++){
				field[i][j] = ' ';
			}
		}
		int pointsInDisc = 0;
		while(pointsInDisc < 100){
			int x = rnd.nextInt(31) - 15;
			int y = rnd.nextInt(31) - 15;
			double dist = Math.hypot(x, y);
			if(dist >= 10 && dist <= 15 && field[x + 15][y + 15] == ' '){
				field[x + 15][y + 15] = 'X';
				pointsInDisc++;
			}
		}
		for(char[] row:field){
			for(char space:row){
				System.out.print(space);
			}
			System.out.println();
		}
	}
}






Fortran: program Constrained_Points
  implicit none
 
  integer, parameter :: samples = 100
  integer :: i, j, n, randpoint
  real :: r
 
  type points
    integer :: x, y
  end type

  type(points) :: set(500), temp


  n = 0
  do i = -15, 15
    do j = -15, 15
      if(sqrt(real(i*i + j*j)) >= 10.0 .and. sqrt(real(i*i + j*j)) <= 15.0) then
        n = n + 1
        set(n)%x = i
        set(n)%y = j
      end if
    end do
  end do





  call random_seed
  do i = 1, samples
    call random_number(r)
    randpoint = r * (n + 1 - i) + i
    temp = set(i)
    set(i) = set(randpoint)
    set(randpoint) = temp
  end do



  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x > temp%x)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do


  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x == temp%x .and. set(j)%y > temp%y)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do
  

  write(*,"(a,a)", advance="no") repeat(" ", set(1)%y+15), "*"
  do i = 2, samples
    if(set(i)%x == set(i-1)%x) then
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y - set(i-1)%y-1), "*"
    else
      n = set(i)%x - set(i-1)%x
      do j = 1, n
        write(*,*)
      end do
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y+15), "*"
    end if
  end do
 
end program
Task: Constrained random points on a circle







Python: >>> from collections import defaultdict
>>> from random import choice
>>> world = defaultdict(int)
>>> possiblepoints = [(x,y) for x in range(-15,16)
		  for y in range(-15,16)
		  if 10 <= abs(x+y*1j) <= 15]
>>> for i in range(100): world[choice(possiblepoints)] += 1

>>> for x in range(-15,16):
	print(''.join(str(min([9, world[(x,y)]])) if world[(x,y)] else ' '
			  for y in range(-15,16)))

	
                               
             1     1           
          1 1                  
      11 1     1  1     1      
     111  1     1211           
      1   2    1 1    11       
      1  11         21         
     1   1            11  1    
   1  2                1 1     
                               
 1  2                          
   1 1                      1  
   1 1                         
   2                      11   
  1                         1  
                         1     
                               
                               
  1                          1 
                         1     
                         2     
                            1  
     1                  1 1    
      1                2   1   
   1   3            11  2      
    11   1    1      1   2     
            1   1    2         
        1  1                   
         1      1     1        
          2 2   1              
               1




Fortran: program Constrained_Points
  implicit none
 
  integer, parameter :: samples = 100
  integer :: i, j, n, randpoint
  real :: r
 
  type points
    integer :: x, y
  end type

  type(points) :: set(500), temp


  n = 0
  do i = -15, 15
    do j = -15, 15
      if(sqrt(real(i*i + j*j)) >= 10.0 .and. sqrt(real(i*i + j*j)) <= 15.0) then
        n = n + 1
        set(n)%x = i
        set(n)%y = j
      end if
    end do
  end do





  call random_seed
  do i = 1, samples
    call random_number(r)
    randpoint = r * (n + 1 - i) + i
    temp = set(i)
    set(i) = set(randpoint)
    set(randpoint) = temp
  end do



  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x > temp%x)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do


  do i = 2, samples
     j = i - 1
     temp = set(i)
        do while (j>=1 .and. set(j)%x == temp%x .and. set(j)%y > temp%y)
           set(j+1) = set(j)
           j = j - 1
        end do
     set(j+1) = temp
  end do
  

  write(*,"(a,a)", advance="no") repeat(" ", set(1)%y+15), "*"
  do i = 2, samples
    if(set(i)%x == set(i-1)%x) then
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y - set(i-1)%y-1), "*"
    else
      n = set(i)%x - set(i-1)%x
      do j = 1, n
        write(*,*)
      end do
      write(*,"(a,a)", advance="no") repeat(" ", set(i)%y+15), "*"
    end if
  end do
 
end program
Task: Call an object method



C#: 
MyClass.Method(someParameter);
 

myInstance.Method(someParameter);









Ada:    package My_Class is
      type Object is tagged private;
      procedure Primitive(Self: Object); 
      procedure Dynamic(Self: Object'Class);
      procedure Static;
   private
      type Object is tagged null record;
   end My_Class;