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()
		}
	}
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <queue>
 
using namespace std;
 
#define pb(n)	push_back(n)
#define mp(n,m) make_pair(n,m)
#define fi 	first
#define se 	second
#define all(r) (r).begin(),(r).end()

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int IMAX=((1<<30)-1)*2+1;
const double EPS=1e-10;
//int mod=1000000007


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



int main(){
	int n;
	//string t;
	while(cin>>n){
		for(int i=0; i<8; i++){
			string t;
			for(int j=n; j>0; j/=10){
				t+=s[(j%10)][i];
			}
			for(int j=t.size(); j<5; j++){
				t+=s[0][i];
			}
			reverse(all(t));
			cout<<t<<endl;
		}
		cout<<endl;
	}
}

C++: 
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

string str[] = { "* = ****", "* =* ***","* =** **","* =*** *",
				 "* =**** "," *= ****"," *=* ***"," *=** **",
                 " *=*** *" ,"*=**** "};

int main()
{
	int cnt = 0;
	string n;

	while (1) {
		if (cnt++)cout << endl;
		cin >>  n;

		while (n.size() < 5)n = "0" + n;

		vector<string> s(n.size());
		rep(i, n.size()) 
			s[i] = str[n[i] - '0'];
		
		rep(i, 8) {
			rep(j, n.size()) {
				cout << s[j][i];
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	string N;
	bool flag = false;
	while (cin >> N) {
		if (flag)cout << endl;
		flag = true;
		int num = 5 - N.size();
		for (int i = 0; i < num; ++i) {

			N.insert(N.begin(), '0');
		}
		vector<vector<int>>memo{
			{ 1,0,1,0,1,1,1,1},
			{ 1,0,1,1,0,1,1,1 },
			{ 1,0,1,1,1,0,1,1 },
			{ 1,0,1,1,1,1,0,1 },
			{ 1,0,1,1,1,1,1,0 },
			{ 0,1,1,0,1,1,1,1 },
			{ 0,1,1,1,0,1,1,1 },
			{ 0,1,1,1,1,0,1,1 },
			{ 0,1,1,1,1,1,0,1 },
			{ 0,1,1,1,1,1,1,0 },

		};
		vector<string>field(8, "     ");
		for (int i = 0; i < 5; ++i) {
			for (int j = 0; j < 8; ++j) {
				field[j][i] = j == 2 ? '=' : memo[N[i] - '0'][j] ? '*' : ' ';
			}
		}
		for (int i = 0; i < field.size(); ++i) {
			cout << field[i] << endl;
		}
	}
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

char s[10];
int main() {
	int n; cin >> n;
	while (1) {
		sprintf(s, "%05d", n);
		rep(i, 5) {
			if (s[i] <= '4')cout << '*';
			else cout << ' ';
		}cout << endl;
		rep(i, 5) {
			if (s[i] >= '5')cout << '*';
			else cout << ' ';
		}cout << endl;
		rep(i, 5)cout << '='; cout << endl;
		rep(i, 5) {
			rep(j, 5) {
				if ((s[j] - 48) % 5 != i)cout << '*';
				else cout << ' ';
			}
			cout << endl;
		}
		if (!(cin >> n))return 0;
		cout << endl;
	}
}

C++: #include <bits/stdc++.h>

#define reps(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) reps(v, 0, n)
#define lep(v, n) reps(v, 1, n + 1)
#define rreps(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v)
#define rrep(v, n) rreps(v, 0, n - 1)
#define rlep(v, n) rreps(v, 1, n)
#define show_a(a, size) rep(a##_it, size) std::cout << a[a##_it] << " \n"[a##_it == a##_it_ - 1];
#define show_v(v) show_a(v, v.size())
#define debug(x) std::cerr << #x << " = " << (x) << "\n";

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

int main()
{
    bool is_first = true;
    int n;
    while (~scanf("%d", &n)){
        if (is_first) is_first = false;
        else puts("");
        char snum[8];
        sprintf(snum, "%05d", n);
        rep(i, 5) printf("%c", " *"[snum[i] < '5']);
        puts("");
        rep(i, 5) printf("%c", "* "[snum[i] < '5']);
        puts("");
        puts("=====");
        rep(i, 5){
            rep(j, 5){
                printf("%c", " *"[i != (snum[j] - '0') % 5]);
            }
            puts("");
        }
    }
    return (0);
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

int data[10][10]={ 	{1,0,2,0,1,1,1,1},
					{1,0,2,1,0,1,1,1},
					{1,0,2,1,1,0,1,1},
					{1,0,2,1,1,1,0,1},
					{1,0,2,1,1,1,1,0},
					{0,1,2,0,1,1,1,1},
					{0,1,2,1,0,1,1,1},
					{0,1,2,1,1,0,1,1},
					{0,1,2,1,1,1,0,1},
					{0,1,2,1,1,1,1,0},
				};

int main(){
	string n;
	int fie[8][5];
	bool f=false;
	while(cin>>n){
		if(f)cout<<endl;
		else f=true;
		rep(i,5)rep(j,8){
			fie[j][i]=data[0][j];
		}
		int len = n.size();

		for(int i=5-len;i<5;i++){
			rep(j,8){
				fie[j][i]=data[n[i-(5-len)]-'0'][j];
			}
		}
		rep(i,8){
			rep(j,5){
				if(fie[i][j]==1){
					cout<<'*';
				}else if(fie[i][j]==2){
					cout<<'=';
				}else cout<<' ';
			}
			cout<<endl;
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<string,int> P;

int main(){
	string str;
	string ge5[] = {"* ="," *="};
	string lt5[] = {" ****","* ***","** **","*** *", "**** "};
	bool isnl=false;
	while(getline(cin,str)){
		if(isnl) cout << endl;
		vector<string> res;

		while(str.size()<5) str = "0" + str;
		for(int i=0;i<str.size();i++){
			string tmp="";
			tmp = ge5[(str[i]-'0') >= 5 ? 1 : 0];
			tmp = tmp + lt5[(str[i]-'0') % 5];
			res.push_back(tmp);
		}

		while(res.size()<5) res.push_back(ge5[0]+lt5[0]);

		for(int i=0;i<res[0].size();i++){
			for(int j=0;j<res.size();j++){
				printf("%c%s",res[j][i],j==res.size()-1 ? "\n" : "");
			}
		}
		isnl = true;
	}
}