Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [10]string{
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** ",
	}
	for scanner.Scan() {
		tmp := strings.Split(fmt.Sprintf("%05s", scanner.Text()), "")
		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()
		}
		fmt.Println()
	}
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,s,b) for(int i=(s);i<(b);i++)
#define rrep(i,s,b) for(int i=(b)-1;i>=(s);i--)
#define all(s) (s).begin(),(s).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int n, cnt = 0; cin >> n; cnt++) {
		if (cnt)cout << endl;
		string s[5] = {};
		rep(i, 0, 5) {
			int a = n % 10;
			if (a >= 5)s[i] += " *=";
			else s[i] += "* =";
			a %= 5;
			rep(j, 0, 5) {
				if (j == a) s[i] += " ";
				s[i] += "*";
			}
			n /= 10;
		}
		rep(h, 0, s[0].size()) {
			string ans = "";
			bool flag = true;
			rep(i, 0, 5) {
				if (flag&&s[i][h] == ' ')continue;
				flag = false;
				ans = s[i][h] + ans;
			}
			cout << ans << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	char s[6], r[5][8], d;
	int n = -1, i, j, c;
	while (1)
	{
		if (cin.eof()) break;
		cin >> n;
		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;
		}
	}
}

C++: #include<iostream>
using namespace std;

int main(void){
	int n;
	while(cin>>n){
		int in[5];
		in[0] = n / 10000	% 10;
		in[1] = n / 1000	% 10;
		in[2] = n / 100		% 10;
		in[3] = n / 10	 	% 10;
		in[4] = n / 1 		% 10;
//		for(int i = 0 ;  i < 5 ; i ++)cout<<int(in[i])<<" ";
		cout<<endl; 
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]<5)cout<<"*";
			else cout<<" ";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]>=5){cout<<"*";in[i]-=5;}
			else cout<<" ";
		cout<<endl;
		
		for(int i = 0 ; i < 5 ; i ++)
			cout<<"=";
		cout<<endl;
		
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==0)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==1)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==2)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==3)cout<<" ";
			else cout<<"*";
		cout<<endl;
		for(int i = 0 ; i < 5 ; i ++)
			if(in[i]==4)cout<<" ";
			else cout<<"*";
		cout<<endl;
		
	}
}

C++: #include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;

int main()
{
	int n;
	while (scanf("%d", &n) != EOF)
	{
		int d[5];
		for (int i = 0 ; i < 5; ++i, n /= 10)
			d[4-i] = n % 10;

		char soro[7][5 + 1];
		memset(soro, '*', sizeof(soro));
		for (int i = 0; i < 7; ++i)
			soro[i][5] = '\0';

		for (int i = 0; i < 5; ++i)
			soro[d[i] >= 5 ? 0 : 1][i] = ' ';
		for (int i = 0; i < 5; ++i)
			soro[d[i]%5 + 2][i] = ' ';

		for (int i = 0; i < 7; ++i)
		{
			puts(soro[i]);
			if (i == 1)
				puts("=====");
		}
		putchar('\n');
	}

	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
	int a;
	bool first=false;
	while(~scanf("%d",&a)){
		if(first)printf("\n");
		first=true;
		for(int i=0;i<5;i++){
			if(a%(int)(pow(10,5-i))/(int)(pow(10,4-i))>=5)printf("*");
			else printf(" ");
		}
		printf("\n");
		for(int i=0;i<5;i++){
			if(a%(int)(pow(10,5-i))/(int)(pow(10,4-i))<5)printf("*");
			else printf(" ");
		}
		printf("\n");
		printf("=====\n");
		for(int i=0;i<5;i++){
			for(int j=0;j<5;j++){
				if((a%(int)(pow(10,5-j))/(int)(pow(10,4-j)))%5==i)printf(" ");
				else printf("*");
			}
			printf("\n");
		}
	}
}

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

using namespace std;

char abacus[8][5];

void init() {
    for (int i = 0; i < 8; i++) {
        if (i == 2) {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = '=';
            }
        } else {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = ' ';
            }
        }
    }
}

int power(int n, int a) {
    int acc = 1;
    for (int i = 0; i < a; i++) {
        acc *= n;
    }
    return acc;
}

void set(int n) {
    for (int i = 4; 0 <= i; i--) {
        int index = 4 - i;
        int d = n / power(10, i);
//        cout << "i: " << i << endl;
//        cout << "d: " << d << endl;
        if (d < 5) {
            abacus[0][index] = '*';
            abacus[1][index] = ' ';
        } else {
            abacus[0][index] = ' ';
            abacus[1][index] = '*';
            d -= 5;
        }
        for (int j = 3; j < 8; j++) {
            abacus[j][index] = '*';
        }
        abacus[d+3][index] = ' ';
        n = n - n / power(10, i) * power(10, i);
    }
}

int main() {
    int n;
    cin >> n;
    init(); set(n);
    for (int i = 0; i < 8; i++) {
        for (int j = 0; j < 5; j++) {
            cout << abacus[i][j];
        }
        cout << endl;
    }
    while (cin >> n) {
        init();
        set(n);
        cout << endl;
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 5; j++) {
                cout << abacus[i][j];
            }
            cout << endl;
        }
    }
    return 0;
}