Go: package main

import (
	"bufio"
	"fmt"
		"os"
	"strconv"
	"strings"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [10]string{
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** ",
	}
	input := make([]string, 0)
	for scanner.Scan() {
		input = append(input, scanner.Text())
	}
	n := len(input)
	cnt := 0
	for cnt < n {
		tmp := strings.Split(fmt.Sprintf("%05s", input[cnt]), "")
		ans := make([]string, 0)
		for _, v := range tmp {
			iv, _ := strconv.Atoi(v)
			ans = append(ans, table[iv])
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 5; j++ {
				fmt.Print(string(ans[j][i]))
			}
			fmt.Println()
		}
		if cnt != n-1 {
			fmt.Println()
		}
		cnt++
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;
string abacus[10] = {"* = ****", 
					 "* =* ***",
					 "* =** **",
					 "* =*** *",
					 "* =**** ",
					 " *= ****",
					 " *=* ***",
					 " *=** **",
					 " *=*** *",
					 " *=**** "};

void solve()
{
	bool init_flag = true;
	int num;
	while(cin >> num)
	{
		if(init_flag)
		{
			init_flag = false;
		}
		else
		{
			cout << endl;
		}
		vector<int> a(5);
		for(int i = 0; i < 5; ++i)
		{
			a[i] = num % 10;
			num /= 10;
		}
		reverse(a.begin(), a.end());
		for(int i = 0; i < 8; ++i)
		{
			for(int j = 0; j < 5; ++j)
			{
				cout << abacus[a[j]][i];
			}
			cout << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    bool first = true;

    for(;;){
        int n;
        if(!(cin >> n))
            return 0;

        vector<string> s(8, string(5, '*'));
        s[2] = string(5, '=');
        for(int i=4; i>=0; --i){
            int a = n % 10;
            n /= 10;

            if(a >= 5)
                s[0][i] = ' ';
            else
                s[1][i] = ' ';
            s[a%5+3][i] = ' ';
        }

        if(first)
            first = false;
        else
            cout << endl;
        for(int i=0; i<8; ++i)
            cout << s[i] << endl;
    }
}

C++: #include <cstdio>
#include <iostream>
#include <string>
#include <map>
#define rep(i, n) for (int i=0; i<n; i++)
using namespace std;

string inp, ans[8];
map<char, string> m;

int main(void)
{
	m['0'] = "* = ****";
	m['1'] = "* =* ***";
	m['2'] = "* =** **";
	m['3'] = "* =*** *";
	m['4'] = "* =**** ";
	m['5'] = " *= ****";
	m['6'] = " *=* ***";
	m['7'] = " *=** **";
	m['8'] = " *=*** *";
	m['9'] = " *=**** ";

	bool first = true;

	while (cin >> inp)
	{
		if (first)
		{
			first = false;
		} else {
			cout << endl;
		}

		ans[5] = "        ";
		ans[6] = "        ";
		ans[7] = "        ";

		while (inp.length() < 5) inp = "0" + inp;
		rep(i, 5) ans[i] = m[inp[i]];
		//rep(i, 5) cout << ans[i] << endl;
		rep(i, 5)
		{
			rep(j, 8)
			{
				if (j < 5 && i < j) continue;
				char w = ans[i][j];
				ans[i][j] = ans[j][i];
				ans[j][i] = w;
			}
		}
		rep(i, 8)
		{
			rep(j, 5)
			{
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <string>

using namespace std;

int main() {
	int n;
	string tama[10] = {"* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ",
					   " *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** "};
	bool hantei2 = false;
	while (cin >> n) {
		if (hantei2) {
			cout << endl;
		}
		int a[5];
		for (int i = 4; i >= 0; i--) {
			a[4-i] = n / (int)pow(10, i);
			n = n % (int)pow(10, i);
		}
		for (int i = 0; i < 8; i++) {
			for (int j = 0; j < 5; j++) {
				/*if (tama[a[j]][i] == ' ') {
					bool hantei = false;
					for (int k = j+1; k < 5; k++) {
						if (tama[a[k]][i] != ' ') {
							hantei = true;
							break;
						}
					}
					if (hantei) {
						cout << tama[a[j]][i];
					} else {
						break;
					}
				} else {*/
					cout << tama[a[j]][i];
				//}
			}
			cout << endl;
		}
		hantei2 = true;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

// infty
#define ULLINF (ULLONG_MAX)
#define LLINF  (LLONG_MAX)
#define IINF   (INT_MAX)
#define INF    (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// pair util
#define FST first
#define SND second

// range validator
#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss_; oss_ << a; return oss_.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

int const dx[] = {-1,0,1,0,-1,1,1,-1};
int const dy[] = {0,-1,0,1,-1,-1,1,1};

//////////////////////////////////////////////////////////////


string abacus[10] = {
  "* = ****",
  "* =* ***",
  "* =** **",
  "* =*** *",
  "* =**** ",
  " *= ****",
  " *=* ***",
  " *=** **",
  " *=*** *",
  " *=**** ",
};

int main() {
  
  string input;
  bool bl = 0;
  char output[20][20];
  while(cin >> input) {
    if(bl) cout << endl;
    bl = 1;
    memset(output, 0, sizeof(output));
    rep(i,5) rep(j,8) output[j][i] = abacus[0][j];
    
    int const N = input.size();
    int const OFFSET = 5-N;
    rep(i, N) {
      int idx = (int)(input[i]-'0');
      rep(j, 8)
	output[j][i+OFFSET] = abacus[idx][j];
    }
    
    rep(i, 8) cout << output[i] << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	char s[6], r[5][8], d;
	int n, i, j, c;
	while (1)
	{
		cin >> n;
		if (cin.eof()) break;
		sprintf(s, "%05d", n);
		for (i = 0; i < 5; i++)
		{
			d = (char)s[i];
			c = atoi(&d);
			if (c < 5)
			{
				r[i][0] = '*';
				r[i][1] = ' ';
			}
			else
			{
				r[i][0] = ' ';
				r[i][1] = '*';
			}
			r[i][2] = '=';
			for (j = 3; j < 8; j++)
			{
				if (c != j-3 && c != j+2)
					r[i][j] = '*';
				else
					r[i][j] = ' ';
			}
		}
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 5; j++)
			{
				cout << r[j][i];
			}
			cout << endl;
		}
		cout << endl;
	}
}

C++: #include <cstdio>
char* s[] = {
    "* = ****",
    "* =* ***",
    "* =** **",
    "* =*** *",
    "* =**** ",
    " *= ****",
    " *=* ***",
    " *=** **",
    " *=*** *",
    " *=**** "
};
char a[5][8];
int n;
int main()
{
    bool f = false;
    while (scanf("%d", &n) != EOF) {
        if (f) puts(""); else f = true;
        for (int i = 0; i < 5; ++i) {
            int t = n % 10;
            for (int j = 0; j < 8; ++j) a[4-i][j] = s[t][j];
            n /= 10;
        }
        for (int j = 0; j < 8; ++j) {
            for (int i = 0; i < 5; ++i) putchar(a[i][j]);
            puts("");
        }
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	char s[6], r[5][8], d;
	int n, i, j, c;
	while (1)
	{
		cin >> n;
		if (cin.eof()) break;
		cout << endl;
		sprintf(s, "%05d", n);
		for (i = 0; i < 5; i++)
		{
			d = (char)s[i];
			c = atoi(&d);
			if (c < 5)
			{
				r[i][0] = '*';
				r[i][1] = ' ';
			}
			else
			{
				r[i][0] = ' ';
				r[i][1] = '*';
			}
			r[i][2] = '=';
			for (j = 3; j < 8; j++)
			{
				if (c != j-3 && c != j+2)
					r[i][j] = '*';
				else
					r[i][j] = ' ';
			}
		}
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 5; j++)
			{
				cout << r[j][i];
			}
			cout << endl;
		}
		cout << endl;
	}
}