kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Symmetric difference
C#: using System;
using System.Collections.Generic;
using System.Linq;

namespace RosettaCode.SymmetricDifference
{
    public static class IEnumerableExtension
    {
        public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> @this, IEnumerable<T> that)
        {
            return @this.Except(that).Concat(that.Except(@this));
        }
    }

    class Program
    {
        static void Main()
        {
            var a = new[] { "John", "Bob", "Mary", "Serena" };
            var b = new[] { "Jim", "Mary", "John", "Bob" };

            foreach (var element in a.SymmetricDifference(b))
            {
                Console.WriteLine(element);
            }
        }
    }
}

Python: >>> setA = {"John", "Bob", "Mary", "Serena"}
>>> setB = {"Jim", "Mary", "John", "Bob"}
>>> setA ^ setB 
{'Jim', 'Serena'}
>>> setA - setB 
{'Serena'}
>>> setB - setA 
{'Jim'}
>>> setA | setB 
{'John', 'Bob', 'Jim', 'Serena', 'Mary'}
>>> setA & setB 
{'Bob', 'John', 'Mary'}
Task: Symmetric difference
Go: package main

import "fmt"

var a = map[string]bool{"John": true, "Bob": true, "Mary": true, "Serena": true}
var b = map[string]bool{"Jim": true, "Mary": true, "John": true, "Bob": true}

func main() {
    sd := make(map[string]bool)
    for e := range a {
        if !b[e] {
            sd[e] = true
        }
    }
    for e := range b {
        if !a[e] {
            sd[e] = true
        }
    }
    fmt.Println(sd)
}

Java: Set<String> setA = new Set<String>{'John', 'Bob', 'Mary', 'Serena'};
Set<String> setB = new Set<String>{'Jim', 'Mary', 'John', 'Bob'};


Set<String> notInSetA = setB.clone();
notInSetA.removeAll(setA);

Set<String> notInSetB = setA.clone();
notInSetB.removeAll(setB);

Set<String> symmetricDifference = new Set<String>();
symmetricDifference.addAll(notInSetA);
symmetricDifference.addAll(notInSetB);


Set<String> union = setA.clone();
union.addAll(setB);

Set<String> intersection = setA.clone();
intersection.retainAll(setB);

Set<String> symmetricDifference2 = union.clone();
symmetricDifference2.removeAll(intersection);

System.debug('Not in set A: ' + notInSetA);
System.debug('Not in set B: ' + notInSetB);
System.debug('Symmetric Difference: ' + symmetricDifference);
System.debug('Symmetric Difference 2: ' + symmetricDifference2);
Task: Symmetric difference
C#: using System;
using System.Collections.Generic;
using System.Linq;

namespace RosettaCode.SymmetricDifference
{
    public static class IEnumerableExtension
    {
        public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> @this, IEnumerable<T> that)
        {
            return @this.Except(that).Concat(that.Except(@this));
        }
    }

    class Program
    {
        static void Main()
        {
            var a = new[] { "John", "Bob", "Mary", "Serena" };
            var b = new[] { "Jim", "Mary", "John", "Bob" };

            foreach (var element in a.SymmetricDifference(b))
            {
                Console.WriteLine(element);
            }
        }
    }
}

C++: #include <iostream>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>

using namespace std;
 
int main( ) {
   string setA[] = { "John", "Bob" , "Mary", "Serena" };
   string setB[] = { "Jim" , "Mary", "John", "Bob"  };
   set<string> 
       firstSet( setA , setA + 4 ),
       secondSet( setB , setB + 4 ),
       symdiff;

   set_symmetric_difference( firstSet.begin(), firstSet.end(),
                             secondSet.begin(), secondSet.end(),
                             inserter( symdiff, symdiff.end() ) );

   copy( symdiff.begin(), symdiff.end(), ostream_iterator<string>( cout , " " ) );
   cout << endl;
   return 0;
}
Task: Symmetric difference
C#: using System;
using System.Collections.Generic;
using System.Linq;

namespace RosettaCode.SymmetricDifference
{
    public static class IEnumerableExtension
    {
        public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> @this, IEnumerable<T> that)
        {
            return @this.Except(that).Concat(that.Except(@this));
        }
    }

    class Program
    {
        static void Main()
        {
            var a = new[] { "John", "Bob", "Mary", "Serena" };
            var b = new[] { "Jim", "Mary", "John", "Bob" };

            foreach (var element in a.SymmetricDifference(b))
            {
                Console.WriteLine(element);
            }
        }
    }
}

Go: package main

import "fmt"

var a = map[string]bool{"John": true, "Bob": true, "Mary": true, "Serena": true}
var b = map[string]bool{"Jim": true, "Mary": true, "John": true, "Bob": true}

func main() {
    sd := make(map[string]bool)
    for e := range a {
        if !b[e] {
            sd[e] = true
        }
    }
    for e := range b {
        if !a[e] {
            sd[e] = true
        }
    }
    fmt.Println(sd)
}
Task: Symmetric difference
C#: using System;
using System.Collections.Generic;
using System.Linq;

namespace RosettaCode.SymmetricDifference
{
    public static class IEnumerableExtension
    {
        public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> @this, IEnumerable<T> that)
        {
            return @this.Except(that).Concat(that.Except(@this));
        }
    }

    class Program
    {
        static void Main()
        {
            var a = new[] { "John", "Bob", "Mary", "Serena" };
            var b = new[] { "Jim", "Mary", "John", "Bob" };

            foreach (var element in a.SymmetricDifference(b))
            {
                Console.WriteLine(element);
            }
        }
    }
}

Java: Set<String> setA = new Set<String>{'John', 'Bob', 'Mary', 'Serena'};
Set<String> setB = new Set<String>{'Jim', 'Mary', 'John', 'Bob'};


Set<String> notInSetA = setB.clone();
notInSetA.removeAll(setA);

Set<String> notInSetB = setA.clone();
notInSetB.removeAll(setB);

Set<String> symmetricDifference = new Set<String>();
symmetricDifference.addAll(notInSetA);
symmetricDifference.addAll(notInSetB);


Set<String> union = setA.clone();
union.addAll(setB);

Set<String> intersection = setA.clone();
intersection.retainAll(setB);

Set<String> symmetricDifference2 = union.clone();
symmetricDifference2.removeAll(intersection);

System.debug('Not in set A: ' + notInSetA);
System.debug('Not in set B: ' + notInSetB);
System.debug('Symmetric Difference: ' + symmetricDifference);
System.debug('Symmetric Difference 2: ' + symmetricDifference2);
Task: Symmetric difference
Java: Set<String> setA = new Set<String>{'John', 'Bob', 'Mary', 'Serena'};
Set<String> setB = new Set<String>{'Jim', 'Mary', 'John', 'Bob'};


Set<String> notInSetA = setB.clone();
notInSetA.removeAll(setA);

Set<String> notInSetB = setA.clone();
notInSetB.removeAll(setB);

Set<String> symmetricDifference = new Set<String>();
symmetricDifference.addAll(notInSetA);
symmetricDifference.addAll(notInSetB);


Set<String> union = setA.clone();
union.addAll(setB);

Set<String> intersection = setA.clone();
intersection.retainAll(setB);

Set<String> symmetricDifference2 = union.clone();
symmetricDifference2.removeAll(intersection);

System.debug('Not in set A: ' + notInSetA);
System.debug('Not in set B: ' + notInSetB);
System.debug('Symmetric Difference: ' + symmetricDifference);
System.debug('Symmetric Difference 2: ' + symmetricDifference2);

Python: >>> setA = {"John", "Bob", "Mary", "Serena"}
>>> setB = {"Jim", "Mary", "John", "Bob"}
>>> setA ^ setB 
{'Jim', 'Serena'}
>>> setA - setB 
{'Serena'}
>>> setB - setA 
{'Jim'}
>>> setA | setB 
{'John', 'Bob', 'Jim', 'Serena', 'Mary'}
>>> setA & setB 
{'Bob', 'John', 'Mary'}
Task: Symmetric difference
Go: package main

import "fmt"

var a = map[string]bool{"John": true, "Bob": true, "Mary": true, "Serena": true}
var b = map[string]bool{"Jim": true, "Mary": true, "John": true, "Bob": true}

func main() {
    sd := make(map[string]bool)
    for e := range a {
        if !b[e] {
            sd[e] = true
        }
    }
    for e := range b {
        if !a[e] {
            sd[e] = true
        }
    }
    fmt.Println(sd)
}

Python: >>> setA = {"John", "Bob", "Mary", "Serena"}
>>> setB = {"Jim", "Mary", "John", "Bob"}
>>> setA ^ setB 
{'Jim', 'Serena'}
>>> setA - setB 
{'Serena'}
>>> setB - setA 
{'Jim'}
>>> setA | setB 
{'John', 'Bob', 'Jim', 'Serena', 'Mary'}
>>> setA & setB 
{'Bob', 'John', 'Mary'}
Task: Symmetric difference
C: #include <stdio.h>
#include <string.h>

const char *A[] = { "John", "Serena", "Bob", "Mary", "Serena" };
const char *B[] = { "Jim", "Mary", "John", "Jim", "Bob" };

#define LEN(x) sizeof(x)/sizeof(x[0])


void uniq(const char *x[], int len)
{
	int i, j;
	for (i = 0; i < len; i++)
		for (j = i + 1; j < len; j++)
			if (x[j] && x[i] && !strcmp(x[i], x[j])) x[j] = 0;
}

int in_set(const char *const x[], int len, const char *match)
{
	int i;
	for (i = 0; i < len; i++)
		if (x[i] && !strcmp(x[i], match))
			return 1;
	return 0;
}


void show_diff(const char *const x[], int lenx, const char *const y[], int leny)
{
	int i;
	for (i = 0; i < lenx; i++)
		if (x[i] && !in_set(y, leny, x[i]))
			printf("  %s\n", x[i]);
}


void show_sym_diff(const char *const x[], int lenx, const char *const y[], int leny)
{
	show_diff(x, lenx, y, leny);
	show_diff(y, leny, x, lenx);
}

int main()
{
	uniq(A, LEN(A));
	uniq(B, LEN(B));
	printf("A \\ B:\n"); show_diff(A, LEN(A), B, LEN(B));
	printf("\nB \\ A:\n"); show_diff(B, LEN(B), A, LEN(A));
	printf("\nA ^ B:\n");  show_sym_diff(A, LEN(A), B, LEN(B));

	return 0;
}

PHP: <?php
$a = array('John', 'Bob', 'Mary', 'Serena');
$b = array('Jim', 'Mary', 'John', 'Bob');

$a = array_unique($a);
$b = array_unique($b);

$a_minus_b = array_diff($a, $b);
$b_minus_a = array_diff($b, $a);

$symmetric_difference = array_merge($a_minus_b, $b_minus_a);

echo 'List A:               ', implode(', ', $a),
   "\nList B:               ", implode(', ', $b),
  "\nA \\ B:                ", implode(', ', $a_minus_b),
  "\nB \\ A:                ", implode(', ', $b_minus_a),
   "\nSymmetric difference: ", implode(', ', $symmetric_difference), "\n";
?>
Task: Symmetric difference
C#: using System;
using System.Collections.Generic;
using System.Linq;

namespace RosettaCode.SymmetricDifference
{
    public static class IEnumerableExtension
    {
        public static IEnumerable<T> SymmetricDifference<T>(this IEnumerable<T> @this, IEnumerable<T> that)
        {
            return @this.Except(that).Concat(that.Except(@this));
        }
    }

    class Program
    {
        static void Main()
        {
            var a = new[] { "John", "Bob", "Mary", "Serena" };
            var b = new[] { "Jim", "Mary", "John", "Bob" };

            foreach (var element in a.SymmetricDifference(b))
            {
                Console.WriteLine(element);
            }
        }
    }
}

PHP: <?php
$a = array('John', 'Bob', 'Mary', 'Serena');
$b = array('Jim', 'Mary', 'John', 'Bob');

$a = array_unique($a);
$b = array_unique($b);

$a_minus_b = array_diff($a, $b);
$b_minus_a = array_diff($b, $a);

$symmetric_difference = array_merge($a_minus_b, $b_minus_a);

echo 'List A:               ', implode(', ', $a),
   "\nList B:               ", implode(', ', $b),
  "\nA \\ B:                ", implode(', ', $a_minus_b),
  "\nB \\ A:                ", implode(', ', $b_minus_a),
   "\nSymmetric difference: ", implode(', ', $symmetric_difference), "\n";
?>
Task: Symmetric difference
C++: #include <iostream>
#include <set>
#include <algorithm>
#include <iterator>
#include <string>

using namespace std;
 
int main( ) {
   string setA[] = { "John", "Bob" , "Mary", "Serena" };
   string setB[] = { "Jim" , "Mary", "John", "Bob"  };
   set<string> 
       firstSet( setA , setA + 4 ),
       secondSet( setB , setB + 4 ),
       symdiff;

   set_symmetric_difference( firstSet.begin(), firstSet.end(),
                             secondSet.begin(), secondSet.end(),
                             inserter( symdiff, symdiff.end() ) );

   copy( symdiff.begin(), symdiff.end(), ostream_iterator<string>( cout , " " ) );
   cout << endl;
   return 0;
}

PHP: <?php
$a = array('John', 'Bob', 'Mary', 'Serena');
$b = array('Jim', 'Mary', 'John', 'Bob');

$a = array_unique($a);
$b = array_unique($b);

$a_minus_b = array_diff($a, $b);
$b_minus_a = array_diff($b, $a);

$symmetric_difference = array_merge($a_minus_b, $b_minus_a);

echo 'List A:               ', implode(', ', $a),
   "\nList B:               ", implode(', ', $b),
  "\nA \\ B:                ", implode(', ', $a_minus_b),
  "\nB \\ A:                ", implode(', ', $b_minus_a),
   "\nSymmetric difference: ", implode(', ', $symmetric_difference), "\n";
?>
Task: Symmetric difference
Go: package main

import "fmt"

var a = map[string]bool{"John": true, "Bob": true, "Mary": true, "Serena": true}
var b = map[string]bool{"Jim": true, "Mary": true, "John": true, "Bob": true}

func main() {
    sd := make(map[string]bool)
    for e := range a {
        if !b[e] {
            sd[e] = true
        }
    }
    for e := range b {
        if !a[e] {
            sd[e] = true
        }
    }
    fmt.Println(sd)
}

PHP: <?php
$a = array('John', 'Bob', 'Mary', 'Serena');
$b = array('Jim', 'Mary', 'John', 'Bob');

$a = array_unique($a);
$b = array_unique($b);

$a_minus_b = array_diff($a, $b);
$b_minus_a = array_diff($b, $a);

$symmetric_difference = array_merge($a_minus_b, $b_minus_a);

echo 'List A:               ', implode(', ', $a),
   "\nList B:               ", implode(', ', $b),
  "\nA \\ B:                ", implode(', ', $a_minus_b),
  "\nB \\ A:                ", implode(', ', $b_minus_a),
   "\nSymmetric difference: ", implode(', ', $symmetric_difference), "\n";
?>
Task: Symmetric difference
Java: Set<String> setA = new Set<String>{'John', 'Bob', 'Mary', 'Serena'};
Set<String> setB = new Set<String>{'Jim', 'Mary', 'John', 'Bob'};


Set<String> notInSetA = setB.clone();
notInSetA.removeAll(setA);

Set<String> notInSetB = setA.clone();
notInSetB.removeAll(setB);

Set<String> symmetricDifference = new Set<String>();
symmetricDifference.addAll(notInSetA);
symmetricDifference.addAll(notInSetB);


Set<String> union = setA.clone();
union.addAll(setB);

Set<String> intersection = setA.clone();
intersection.retainAll(setB);

Set<String> symmetricDifference2 = union.clone();
symmetricDifference2.removeAll(intersection);

System.debug('Not in set A: ' + notInSetA);
System.debug('Not in set B: ' + notInSetB);
System.debug('Symmetric Difference: ' + symmetricDifference);
System.debug('Symmetric Difference 2: ' + symmetricDifference2);

PHP: <?php
$a = array('John', 'Bob', 'Mary', 'Serena');
$b = array('Jim', 'Mary', 'John', 'Bob');

$a = array_unique($a);
$b = array_unique($b);

$a_minus_b = array_diff($a, $b);
$b_minus_a = array_diff($b, $a);

$symmetric_difference = array_merge($a_minus_b, $b_minus_a);

echo 'List A:               ', implode(', ', $a),
   "\nList B:               ", implode(', ', $b),
  "\nA \\ B:                ", implode(', ', $a_minus_b),
  "\nB \\ A:                ", implode(', ', $b_minus_a),
   "\nSymmetric difference: ", implode(', ', $symmetric_difference), "\n";
?>
Task: Symmetric difference
Python: >>> setA = {"John", "Bob", "Mary", "Serena"}
>>> setB = {"Jim", "Mary", "John", "Bob"}
>>> setA ^ setB 
{'Jim', 'Serena'}
>>> setA - setB 
{'Serena'}
>>> setB - setA 
{'Jim'}
>>> setA | setB 
{'John', 'Bob', 'Jim', 'Serena', 'Mary'}
>>> setA & setB 
{'Bob', 'John', 'Mary'}

PHP: <?php
$a = array('John', 'Bob', 'Mary', 'Serena');
$b = array('Jim', 'Mary', 'John', 'Bob');

$a = array_unique($a);
$b = array_unique($b);

$a_minus_b = array_diff($a, $b);
$b_minus_a = array_diff($b, $a);

$symmetric_difference = array_merge($a_minus_b, $b_minus_a);

echo 'List A:               ', implode(', ', $a),
   "\nList B:               ", implode(', ', $b),
  "\nA \\ B:                ", implode(', ', $a_minus_b),
  "\nB \\ A:                ", implode(', ', $b_minus_a),
   "\nSymmetric difference: ", implode(', ', $symmetric_difference), "\n";
?>
Task: Bitmap_Bresenham's line algorithm
C: void line(int x0, int y0, int x1, int y1) {

  int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
  int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; 
  int err = (dx>dy ? dx : -dy)/2, e2;

  for(;;){
    setPixel(x0,y0);
    if (x0==x1 && y0==y1) break;
    e2 = err;
    if (e2 >-dx) { err -= dy; x0 += sx; }
    if (e2 < dy) { err += dx; y0 += sy; }
  }
}

C#: using System;
using System.Drawing;
using System.Drawing.Imaging;
static class Program
{
    static void Main()
    {
        new Bitmap(200, 200)
            .DrawLine(0, 0, 199, 199, Color.Black).DrawLine(199,0,0,199,Color.Black)
            .DrawLine(50, 75, 150, 125, Color.Blue).DrawLine(150, 75, 50, 125, Color.Blue)
            .Save("line.png", ImageFormat.Png);
    }
    static Bitmap DrawLine(this Bitmap bitmap, int x0, int y0, int x1, int y1, Color color)
    {
        int dx = Math.Abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
        int dy = Math.Abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
        int err = (dx > dy ? dx : -dy) / 2, e2;
        for(;;) {
            bitmap.SetPixel(x0, y0, color);
            if (x0 == x1 && y0 == y1) break;
            e2 = err;
            if (e2 > -dx) { err -= dy; x0 += sx; }
            if (e2 < dy) { err += dx; y0 += sy; }
        }
        return bitmap;
    }
}
Task: Bitmap_Bresenham's line algorithm
C: void line(int x0, int y0, int x1, int y1) {

  int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
  int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; 
  int err = (dx>dy ? dx : -dy)/2, e2;

  for(;;){
    setPixel(x0,y0);
    if (x0==x1 && y0==y1) break;
    e2 = err;
    if (e2 >-dx) { err -= dy; x0 += sx; }
    if (e2 < dy) { err += dx; y0 += sy; }
  }
}

C++: void Line( float x1, float y1, float x2, float y2, const Color& color )
{
        
  const bool steep = (fabs(y2 - y1) > fabs(x2 - x1));
  if(steep)
  {
    std::swap(x1, y1);
    std::swap(x2, y2);
  }

  if(x1 > x2)
  {
    std::swap(x1, x2);
    std::swap(y1, y2);
  }

  const float dx = x2 - x1;
  const float dy = fabs(y2 - y1);
  
  float error = dx / 2.0f;
  const int ystep = (y1 < y2) ? 1 : -1;
  int y = (int)y1;

  const int maxX = (int)x2;

  for(int x=(int)x1; x<=maxX; x++)
  {
    if(steep)
    {
        SetPixel(y,x, color);
    }
    else
    {
        SetPixel(x,y, color);
    }
              
    error -= dy;
    if(error < 0)
    {
        y += ystep;
        error += dx;
    }
  }
}
Task: Bitmap_Bresenham's line algorithm
C: void line(int x0, int y0, int x1, int y1) {

  int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
  int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; 
  int err = (dx>dy ? dx : -dy)/2, e2;

  for(;;){
    setPixel(x0,y0);
    if (x0==x1 && y0==y1) break;
    e2 = err;
    if (e2 >-dx) { err -= dy; x0 += sx; }
    if (e2 < dy) { err += dx; y0 += sy; }
  }
}

Go: package raster


func (b *Bitmap) Line(x0, y0, x1, y1 int, p Pixel) {
    
    dx := x1 - x0
    if dx < 0 {
        dx = -dx
    }
    dy := y1 - y0
    if dy < 0 {
        dy = -dy
    }
    var sx, sy int
    if x0 < x1 {
        sx = 1
    } else {
        sx = -1
    }
    if y0 < y1 {
        sy = 1
    } else {
        sy = -1
    }
    err := dx - dy

    for {
        b.SetPx(x0, y0, p)
        if x0 == x1 && y0 == y1 {
            break
        }
        e2 := 2 * err
        if e2 > -dy {
            err -= dy
            x0 += sx
        }
        if e2 < dx {
            err += dx
            y0 += sy
        }
    }
}

func (b *Bitmap) LineRgb(x0, y0, x1, y1 int, c Rgb) {
    b.Line(x0, y0, x1, y1, c.Pixel())
}
Task: Bitmap_Bresenham's line algorithm
C: void line(int x0, int y0, int x1, int y1) {

  int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
  int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; 
  int err = (dx>dy ? dx : -dy)/2, e2;

  for(;;){
    setPixel(x0,y0);
    if (x0==x1 && y0==y1) break;
    e2 = err;
    if (e2 >-dx) { err -= dy; x0 += sx; }
    if (e2 < dy) { err += dx; y0 += sy; }
  }
}

Python: def line(self, x0, y0, x1, y1):
    "Bresenham's line algorithm"
    dx = abs(x1 - x0)
    dy = abs(y1 - y0)
    x, y = x0, y0
    sx = -1 if x0 > x1 else 1
    sy = -1 if y0 > y1 else 1
    if dx > dy:
        err = dx / 2.0
        while x != x1:
            self.set(x, y)
            err -= dy
            if err < 0:
                y += sy
                err += dx
            x += sx
    else:
        err = dy / 2.0
        while y != y1:
            self.set(x, y)
            err -= dx
            if err < 0:
                x += sx
                err += dy
            y += sy        
    self.set(x, y)
Bitmap.line = line

bitmap = Bitmap(17,17)
for points in ((1,8,8,16),(8,16,16,8),(16,8,8,1),(8,1,1,8)):
    bitmap.line(*points)
bitmap.chardisplay()
Task: Bitmap_Bresenham's line algorithm
C: void line(int x0, int y0, int x1, int y1) {

  int dx = abs(x1-x0), sx = x0<x1 ? 1 : -1;
  int dy = abs(y1-y0), sy = y0<y1 ? 1 : -1; 
  int err = (dx>dy ? dx : -dy)/2, e2;

  for(;;){
    setPixel(x0,y0);
    if (x0==x1 && y0==y1) break;
    e2 = err;
    if (e2 >-dx) { err -= dy; x0 += sx; }
    if (e2 < dy) { err += dx; y0 += sy; }
  }
}

VB: 
	Dim map(48,40), list(10), ox, oy
	data=Array(1,8, 8,16, 16,8, 8,1, 1,8)
	For i=0 To UBound(map,1): For j=0 To UBound(map,2)
		map(i,j)="."
	Next: Next 
	points=(UBound(data)+1)/2
	For p=1 To points 
		x=data((p-1)*2)
		y=data((p-1)*2+1)
		list(p)=Array(x,y)
		If p=1 Then minX=x: maxX=x: minY=y: maxY=y
		If x<minX Then minX=x
		If x>maxX Then maxX=x
		If y<minY Then minY=y
		If y>maxY Then maxY=y
	Next 
	border=2
	minX=minX-border*2  : maxX=maxX+border*2
	minY=minY-border    : maxY=maxY+border
	ox =-minX           : oy =-minY
	wx=UBound(map,1)-ox : If maxX>wx Then maxX=wx
	wy=UBound(map,2)-oy : If maxY>wy Then maxY=wy
	For x=minX To maxX: map(x+ox,0+oy)="-": Next 
	For y=minY To maxY: map(0+ox,y+oy)="|": Next 
	map(ox,oy)="+"
	For p=1 To points-1
		draw_line list(p), list(p+1)
	Next 
	For y=maxY To minY Step -1
		line=""
		For x=minX To maxX
			line=line & map(x+ox,y+oy)
		Next 
		Wscript.Echo line
	Next 

Sub draw_line(p1, p2)
	Dim x,y,xf,yf,dx,dy,sx,sy,err,err2
    x =p1(0)     : y =p1(1)
	xf=p2(0)     : yf=p2(1)
	dx=Abs(xf-x) : dy=Abs(yf-y)
	If x<xf Then sx=+1: Else sx=-1
	If y<yf Then sy=+1: Else sy=-1
	err=dx-dy
	Do
		map(x+ox,y+oy)="X"
		If x=xf And y=yf Then Exit Do
		err2=err+err
		If err2>-dy Then err=err-dy: x=x+sx
		If err2< dx Then err=err+dx: y=y+sy
	Loop
End Sub
Task: Bitmap_Bresenham's line algorithm
C#: using System;
using System.Drawing;
using System.Drawing.Imaging;
static class Program
{
    static void Main()
    {
        new Bitmap(200, 200)
            .DrawLine(0, 0, 199, 199, Color.Black).DrawLine(199,0,0,199,Color.Black)
            .DrawLine(50, 75, 150, 125, Color.Blue).DrawLine(150, 75, 50, 125, Color.Blue)
            .Save("line.png", ImageFormat.Png);
    }
    static Bitmap DrawLine(this Bitmap bitmap, int x0, int y0, int x1, int y1, Color color)
    {
        int dx = Math.Abs(x1 - x0), sx = x0 < x1 ? 1 : -1;
        int dy = Math.Abs(y1 - y0), sy = y0 < y1 ? 1 : -1;
        int err = (dx > dy ? dx : -dy) / 2, e2;
        for(;;) {
            bitmap.SetPixel(x0, y0, color);
            if (x0 == x1 && y0 == y1) break;
            e2 = err;
            if (e2 > -dx) { err -= dy; x0 += sx; }
            if (e2 < dy) { err += dx; y0 += sy; }
        }
        return bitmap;
    }
}

C++: void Line( float x1, float y1, float x2, float y2, const Color& color )
{
        
  const bool steep = (fabs(y2 - y1) > fabs(x2 - x1));
  if(steep)
  {
    std::swap(x1, y1);
    std::swap(x2, y2);
  }

  if(x1 > x2)
  {
    std::swap(x1, x2);
    std::swap(y1, y2);
  }

  const float dx = x2 - x1;
  const float dy = fabs(y2 - y1);
  
  float error = dx / 2.0f;
  const int ystep = (y1 < y2) ? 1 : -1;
  int y = (int)y1;

  const int maxX = (int)x2;

  for(int x=(int)x1; x<=maxX; x++)
  {
    if(steep)
    {
        SetPixel(y,x, color);
    }
    else
    {
        SetPixel(x,y, color);
    }
              
    error -= dy;
    if(error < 0)
    {
        y += ystep;
        error += dx;
    }
  }
}