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 <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;
		}
		while(in.size() < 5)
			in = "0"+in;
		rep(i,8){
			rep(j,5)
				cout << digits[(in[j]-'0')][i];
			cout << endl;
		}
	}
	return 0;
}

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

#define rep(i, n) for(i = 0;i < n;++i)

char f[5][8];
signed main(void){
  int i, j, n;
  for(int t = 0;;t++){
    if(scanf("%d", &n) == -1)break;
    if(t)puts("");
    rep(i, 5){
      rep(j, 8)f[i][j] = '*';
      f[i][2] = '=';
      f[i][1 - (n % 10) / 5] = ' ';
      f[i][3 + (n % 5)] = ' ';
      n /= 10;
    }

    rep(j, 8){
      rep(i, 5)printf("%c", f[4 - i][j]);
      puts("");
    }
  }
  return 0;
}

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

int main() {
    while (true){
        int N;
        int num[5] = {0};
        
        cin >> N;
        
        if(N == EOF) break;
        
        num[0] = N/10000;
        N %= 10000;
        num[1] = N/1000;
        N %= 1000;
        num[2] = N/100;
        N %= 100;
        num[3] = N/10;
        N %= 10;
        num[4] = N;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] < 5) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] > 4) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            cout << "=";
        }
        cout << endl;
        
        for(int i = 0; i > 5; i++) {
            if(num[i] > 4) num[i] -= 5;
        }
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 0) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 1) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 2) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 3) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 4) cout << '*';
            else cout << " ";
        }
        
        cout << "\n\n";
    }
    return 0;
}

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

int main(){
    int n,i,j;
    while( cin >> n ){
        int f[5], s[5];
        for(i=4;i>=0;i--){
            f[i] = n%10/5;
            s[i] = n%5;
            n /= 10;
        }
        for(i=0;i<5;i++){
            if(!f[i]) cout << "*";
            else cout << " ";
        }
        cout << endl;
        for(i=0;i<5;i++){
            if(f[i]) cout << "*";
            else cout << " ";
        }
        cout << endl;
        cout << "=====" << endl;
        for(i=0;i<5;i++){
            for(j=0;j<5;j++){
                if(s[j]==i) cout << " ";
                else cout << "*";
            }
            cout << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

string itos5 (int n )
{
	stringstream ss;
	ss << n;
	string res = ss.str();
	int len = res.length();
	int i;

	if (len < 5){
		for (i = 0; i < 5 - len; ++i){
			res = '0' + res;
		} // end for
	} // end if

	return res;
}

int main()
{
	const string pos[8] = {
	"*****     ",
	"     *****",
	"==========",
	" **** ****",
	"* **** ***",
	"** **** **",
	"*** **** *",
	"**** **** "
};
	int i,j,k;

//	cut here before submit 
//	freopen ("testcase.abacus", "r", stdin );
	string str = "";

	vector <vector <string> > R;

	while (getline (cin, str ) ){
		if (str.empty() ){
			break;
		} // end if
		vector <string> res (8, string ( 5, ' ') );
//		vector <string> res (10, string (5, ' ') );
		int n;
		string t = "";
		stringstream ss(str);
		ss >> n;

		t = itos5 (n );

		for (i = 0; i < 5; ++i){
			int m = t[i] - '0';
			for (j = 0; j < 8; ++j){
				res[j][i] = pos[j][m];
			} // end for
		} // end for
		
		R.push_back(res );
		res.clear();

	} // end loop
	int size = R.size();

	for (k = 0; k < size; ++k){
		vector<string>::iterator it = R[k].begin();
		for (; it != R[k].end(); ++it ){
			string str = (*it);
			int len = str.length();

			for (i = 0; i < len; ++i){
				cout << str[i];
			} // end for
			cout << endl;
		} // end for
		if (k != size - 1 ) {
			cout << endl;
		} // end if
	} // end for
	
	return 0;
}