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*****/
#include <iostream>
#include <string>
/*****デバッグ定義*****/
//#define DEBUG
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/

/*****その他関数置き場*****/

/*****main関数*****/
int main(){
/*****変数置き場*****/
	string table[] = {
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** "
	};
	string answer[5];
	int number;
	int k=0;
	int dummy = 0;
	/*****処理部*****/
	while(1){
		cin >> number;
		if(cin.eof())	break;
		k=4;
		for(int i=1;i<=10000;i*=10){
			answer[k] = table[(number/i)%10];
			//cout << (number/i)%10 << endl;
			k--;
		}
		if(dummy!=0)	cout << endl;
		else			dummy = 1;
		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				cout << answer[j][i];
			}
			cout << endl;
		}
	}
	/*****処理終了後*****/
	return 0;
}

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[] = {" ****","* ***","** **","*** *", "**** "};
	while(getline(cin,str)){
		vector<string> res;
		for(int i=str.size()-1;i>=0;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]);

		reverse(res.begin(),res.end());
		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" : "");
			}
		}
	}
}

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;
	bool f=false;
	while(cin>>n){
		if(f)cout<<endl;
		else f=true;
		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;
		}
	}
}

C++: #include <iostream>
#include <string>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main() {
	string n;
	bool p = 0;
	while(cin >> n) {
		if(p) cout << endl;
		p = 1;
		int k = n.length();
		string ans[8][5];
		rep(i,8) {
			rep(j,5) {
				if(i==2) ans[i][j] = '=';
				else if(i==1||i==3) ans[i][j] = ' ';
				else ans[i][j] = '*';
			}
		}
		rep(i,k) {
			int m = n[i]-'0';
			if(m>=5) swap(ans[0][i+5-k], ans[1][i+5-k]);
			rep(j,m%5) swap(ans[3+j][i+5-k],ans[4+j][i+5-k]);
		}
		rep(i,8) {
			rep(j,5) {
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
string s[10]={
  {"* = ****"},
  {"* =* ***"},
  {"* =** **"},
  {"* =*** *"},
  {"* =**** "},
  {" *= ****"},
  {" *=* ***"},
  {" *=** **"},
  {" *=*** *"},
  {" *=**** "},
};
int main(){
  char in[5]={0};
  bool a=false;
  while(cin>>in){
    if(a)cout<<endl;
	a=true;
    int h=strlen(in);
	rep(i,8){
      rep(j,5-h)cout<<s[0][i];
	  rep(j,h)cout<<s[in[j]-'0'][i];
	  cout<<endl;
	} 
  }
}

C++: #include <iostream>

using namespace std;

char table[10][10] = {

  "* = ****",
  "* =* ***",
  "* =** **",
  "* =*** *",
  "* =**** ",
  " *= ****",
  " *=* ***",
  " *=** **",
  " *=*** *",
  " *=**** "

};

int main() {

  int n;

  char abacus[10][10];
  int digit[5];
 
  int flag=0;

  while(cin >> n) {

    if(flag==1) {

      cout << endl;

    }

    else flag=1;

    digit[0]=n%100000/10000;

    digit[1]=n%10000/1000;

    digit[2]=n%1000/100;

    digit[3]=n%100/10;

    digit[4]=n%10;

    for(int i=0;i<5;i++) {

      for(int j=0;j<8;j++) {

	abacus[i][j]=table[digit[i]][j];

      }

    }

    for(int i=0;i<8;i++) {

      for(int j=0;j<5;j++) {

	cout << abacus[j][i];

      }

      cout << endl;

    }

  }

  return 0;

}

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

using namespace std;

string number[10] = {"* = ****",
                     "* =* ***",
		     "* =** **",
		     "* =*** *",
		     "* =**** ",
		     " *= ****",
		     " *=* ***",
		     " *=** **",
		     " *=*** *",
		     " *=**** "};
int main(){
    string str;
    int tcase = 0;
    while( cin >> str ){
	while( str.size() < 5 ) str = "0" + str;

	if ( tcase++ ) cout << endl;
	for ( int i = 0; i < 8; i++ ){
	    for ( int j = 0; j < 5; j++ ){
		cout << number[str[j]-'0'][i];
	    }
	    cout << endl;
	}
	
    }

    return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
string res[8];
/*
 0123456789
0*****     
1     *****
2==========
3 **** ****
4* **** ***
5** **** **
6*** **** *
7**** **** 
*/
int main() {
    int flag=0;
    while (scanf("%d",&n)!=EOF) {
        if (flag) printf("\n");
        else flag=1;
        fill(res, res+8, "");
        res[2]="=====";
        int ten=10000;
        for (int i=0; i<5; i++) {
            int x=n/ten;
            n%=ten;
            ten/=10;
            if (0<=x&&x<=4) {
                res[0]+='*';
                res[1]+=' ';
            } else {
                res[0]+=' ';
                res[1]+='*';
            }
            if (x==0||x==5) res[3]+=' ';
            else res[3]+='*';
            if (x==1||x==6) res[4]+=' ';
            else res[4]+='*';
            if (x==2||x==7) res[5]+=' ';
            else res[5]+='*';
            if (x==3||x==8) res[6]+=' ';
            else res[6]+='*';
            if (x==4||x==9) res[7]+=' ';
            else res[7]+='*';
        }
        for (int i=0; i<8; i++) cout << res[i] << endl;
    }
}