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 <cstring>
#include <cstdio>
using namespace std;

const int MAX = 5;

int len;
char num[6];
char field1[MAX][MAX], field2[2][MAX];
void change(int i) {
  
  if(num[i] % 5 == 1) { field1[1][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 2) { field1[2][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 3) { field1[3][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 4) { field1[4][i] = ' '; field1[0][i] = '*'; }
  if(num[i] >= 5) { field2[0][i] = ' '; field2[1][i] = '*'; }
}
  
int main() {
  char dumy[6];
  bool flag = 0;
  while(1/*scanf("%s", dumy) != EOF*/) {
    if(scanf("%s", dumy) == EOF) { break; flag = true; }
    if(flag == true) cout << endl;
    flag = 1;
    memset(num, '#', sizeof(num));
    for(int i = 1 ; i < MAX ; i++)
      for(int j = 0 ; j < MAX ; j++) field1[i][j] = '*';
    
    for(int i = 0 ; i < MAX ; i++) field1[0][i] = ' ';

    for(int i = 0 ; i < MAX ; i++) {
      field2[0][i] = '*'; 
      field2[1][i] = ' ';
    }
    // cout << "OK" << endl;
    len = strlen(dumy);
    //cout << len << endl;
    len = MAX - len;
    //cout << len << endl;
    num[len] = dumy[0];
    if(len+1 < 5) num[len+1] = dumy[1];
    if(len+2 < 5) num[len+2] = dumy[2];
    if(len+3 < 5) num[len+3] = dumy[3];
    if(len+4 < 5) num[len+4] = dumy[4];
    //cout << "OK" << endl;
    for(int i = 4 ; i >= 0 ; i--) {
      if(num[i] != '#') {
	num[i] = num[i] - '0';
	change(i);
      }
    }
    
    for(int i = 0 ; i < 2 ; i++) {
      for(int j = 0 ; j < 5 ; j++) {
	cout << field2[i][j];
      }
      cout << endl;
    }
  
    cout << "=====" << endl;
    
    for(int i = 0 ; i < 5 ; i++) {
      for(int j = 0 ; j < 5 ; j++) {
	cout << field1[i][j];
      }
      cout << endl;
    }
    memset(num, '#', sizeof(num));
  }
  return 0;
}

C++: #include <string>
#include <iostream>
using namespace std;
string s; int c;
int main() {
	while(cin >> s) {
		if(c++) printf("\n");
		while(s.size() != 5) s = "0" + s;
		for(int i = 0; i < 5; i++) printf("%c", s[i] < '5' ? '*' : ' '); printf("\n");
		for(int i = 0; i < 5; i++) printf("%c", s[i] > '4' ? '*' : ' '); printf("\n");
		printf("=====\n");
		for(int i = 0; i < 5; i++) {
			for(int j = 0; j < 5; j++) printf("%c", (s[i] - 48) % 5 == i ? ' ' : '*'); printf("\n");
		}
	}
}

C++: #include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

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

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 30;

string digits[10];

int main(void){
	rep(i,10){
		digits[i]="";
		if(i>=5)
			digits[i]+=" *=";
		else
			digits[i]+="* =";
		rep(j,5){
			if(i%5==j)
				digits[i]+=" ";
			else
				digits[i]+="*";
		}
	}
	string in;
	bool first=true;
	while(cin >> in ){
		if(cin.eof())
			break;
		else if(!first){
			first=false;
			cout << endl;
		}
		int n=in.size();
		rep(i,8){
			rep(j,n)
				cout << digits[(in[j]-'0')][i];
			cout << endl;
		}
	}
	return 0;
}

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

using namespace std;

int main() {
    int n = 0;
    int N[5] = {0};
    cin >> n;
    
    N[0] = n / 10000;
    n %= 10000;
    N[1] = n / 1000;
    n %= 1000;
    N[2] = n / 100;
    n %= 100;
    N[3] = n / 10;
    n %= 10;
    N[4] = n;
    
    for(int i = 0; i < 8; i++) {
        for (int j = 0; j < 5; j++) {
            if(i == 0) {
                if (N[j] < 5) cout << "*";
                else cout << " ";
            }
            if(i == 1) {
                if (N[j] < 5) cout << " ";
                else cout << "*";
            }
            
            if(i == 2) cout << "=";
            
            if(i == 3) {
                if (N[j] > 4) N[j] -= 5;
                if (N[j] != 0) cout << "*";
                else cout << " ";
            }
            
            if(i == 4) {
                if (N[j] != 1) cout << "*";
                else cout << " ";
            }
            
            if(i == 5) {
                if (N[j] != 2) cout << "*";
                else cout << " ";
            }
            if(i == 6) {
                if (N[j] != 3) cout << "*";
                else cout << " ";
            }
            if(i == 7) {
                if (N[j] != 4) cout << "*";
                else cout << " ";
            }
            
            if (j == 4) cout << "\n";
        }        
    }
    
    return 0;
}