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 <vector>
using namespace std;

int main()
{
  int n;
  bool first = true;
  while (cin >> n) {
    vector<string> ans(8, "");
    for (int keta = 0; keta < 5; ++keta) {
      int d = n % 10;
      
      if (d >= 5) {
	ans[0] = " " + ans[0];
	ans[1] = "*" + ans[1];
      } else {
	ans[0] = "*" + ans[0];
	ans[1] = " " + ans[1];
      }
      ans[2] += "=";

      for (int i = 0; i < 5; ++i) {
	if (i == d%5)
	  ans[i+3] = " " + ans[i+3];
	else
	  ans[i+3] = "*" + ans[i+3];
      }

      n /= 10;
    }
    if (!first)
      cout << endl;
    for (unsigned int i = 0; i < ans.size(); ++i)
      cout << ans[i] << endl;
    cout << endl;
  }
  return 0;
}

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, 4) {
				if (j == a) s[i] += " ";
				s[i] += "*";
			}
			if (a == 4)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++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
# include <unordered_map>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 

int main()
{
	string s;
	bool f = false;
	while (cin >> s)
	{
		if (f)cout << endl;
		reverse(all(s));
		while (s.size() < 5)s += '0';
		reverse(all(s));
		f = true;
		for (int i = 0; i < s.size(); i++)
		{
			char c = '*';
			if (s[i] >= '5')
				c = ' ';
			cout << c;
		}cout << endl;
		for (int i = 0; i < s.size(); i++)
		{
			char c = ' ';
			if (s[i] >= '5')
				c = '*';
			cout << c;
		}cout << endl;
		for (int i = 0; i < s.size(); i++)
		{
			cout << '=';
		}cout << endl;

		for (int j = 0; j < 5; j++)
		{
			for (int i = 0; i < s.size(); i++)
			{
				char c = '*';
				if (s[i] == '0' + j || s[i] == '5' + j)
					c = ' ';
				cout << c;
			}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 (cin >> n) {
		if (cnt++)cout << endl;

		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, 5) {
				cout << s[j][i];
			}
			cout << endl;
		}
	}
	return 0;
}

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

int main() {
    int n;
    bool spaceFlag = false;
    while (cin >> n) {
        if (spaceFlag) {
            cout << endl;
        } else {
            spaceFlag = true;
        }
        int digit[5];
        for (int i = 0; i < 5; i++) {
            digit[i] = (n % (int) pow(10, i + 1)) / (int) pow(10, i);
        }
        char line[8][6] = {};
        for (int i = 0; i < 5; i++) {
            line[0][i] = (digit[4 - i] < 5) ? '*' : ' ';
            line[1][i] = (digit[4 - i] < 5) ? ' ' : '*';
            line[2][i] = '=';
            line[3][i] = (digit[4 - i] % 5 == 0) ? ' ' : '*';
            line[4][i] = (digit[4 - i] % 5 == 1) ? ' ' : '*';
            line[5][i] = (digit[4 - i] % 5 == 2) ? ' ' : '*';
            line[6][i] = (digit[4 - i] % 5 == 3) ? ' ' : '*';
            line[7][i] = (digit[4 - i] % 5 == 4) ? ' ' : '*';
        }
        for (int i = 0; i < 8; i++) {
            cout << line[i] << endl;
        }
    }
}