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

int main(){
	int n,c,a,i,j;
	while(cin >> n){
		int b[8][5];
		c = 10000;
		for(i=0;i<5;i++){
			a = n/c;
			if(a<5) {
				b[0][i] = 1;
				b[1][i] = 0;
			}
			else {
				b[0][i] = 0;
				b[1][i] = 1;
			}
			b[2][i] = 2;
			if(a==0||a==5){
				for(j=4;j<8;j++){
					b[j][i] = 1;
				}
			}
			else if(a==1||a==6){
				for(j=3;j<8;j++){
					if(j==4) continue;
					b[j][i] = 1;
				}
			}
			else if(a==2||a==7){
				for(j=3;j<8;j++){
					if(j==5) continue;
					b[j][i] = 1;
				}
			}
			else if(a==3||a==8){
				for(j=3;j<8;j++){
					if(j==6) continue;
					b[j][i] = 1;
				}
			}
			else {
				for(j=3;j<7;j++){
					b[j][i] = 1;
				}
			}
			n -= c*a;
			c /= 10;
		}
		for(i=0;i<8;i++){
			for(j=0;j<5;j++){
				if(b[i][j] == 1) cout << "*";
				else if(b[i][j] == 2) cout << "=";
				else printf("%*s",1,"");
				b[i][j] = 0;
			}
			cout << '\n';
		}
	}
	return 0;
}

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

int main(){
	int input;
	int abacus[5];

	while(cin >> input){
		for(int i=0; i< 5; i++){
			abacus[4-i] = input% 10;
			input/= 10;
		}

		for(int i=0; i < 5; i++){
			cout << abacus[i];
		}
		cout << endl;

		for(int i=0; i < 5; i++){
			if(abacus[i] < 5) cout << '*';
			else cout << " ";
		}
		cout << endl;

		for(int i=0; i< 5; i++){
			if(abacus[i] < 5){
				cout << " ";
			}
			else{
				cout << "*";
				abacus[i]-= 5;
			}
		}
		cout << endl;

		cout << "=====" << endl;

		for(int i=0; i < 5; i++){
			for(int j=0; j < 5; j++){
				if(abacus[j] == 0) cout << " ";
				else cout << "*";

				abacus[j]--;
			}
			cout << endl;
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>


#ifdef _DEBUG
#define typeof(X) std::identity<decltype(X)>::type //C++0x (for vs2010)
#else
#define typeof(X) __typeof__(X) // for gcc
#endif

#define sz(a)  int((a).size())
#define FOREACH(it, c) for (typeof((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define FOR(i,count) for (int i = 0; i < (int)(count); i++)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
const int MODULO = 100000 ;
const int INF = 100000000; //1e8

typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Cd;

using namespace std;


int main()
{
	int n;
	bool nw = false;
	while(cin>>n){
		if(nw) puts("");
		nw = true;
		int a[5];
		for(int i = 10000,j = 0; j < 5; i /= 10,j++) a[j] = (n / i) % 10;
		char c[6];
		FOR(j,5) c[j] = a[j]/5 ? ' ':'*';
		c[5] = '\0';
		puts(c);
		FOR(j,5) c[j] = a[j]/5 ? '*':' ';
		puts(c);
		puts("=====");
		FOR(i,5){
			FOR(j,5){
				putchar(a[j]%5 == i ? ' ':'*');
			}
			puts("");
		}
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#define p push_back
using namespace std;
vector<char> v[10];

void solve(char c){
  if(0<=c-'0' && c-'0'<=4){
    v[0].p('*');
    v[1].p(' ');
  }
  else{
    v[0].p(' ');
    v[1].p('*');
   }
  v[2].p('=');
  if(c-'0' == 0){
    v[3].p(' ');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p('*');
  }
  else if(c-'0' == 1){
 
  v[3].p('*');v[4].p(' ');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 2){
 
  v[3].p('*');v[4].p('*');v[5].p(' ');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 3){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p(' ');v[7].p('*');

  }
 else if(c-'0' == 4){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p(' ');
  }
 else if(c-'0' == 5){
 
  v[3].p(' ');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 6){
  v[3].p('*');v[4].p(' ');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 7){
 
  v[3].p('*');v[4].p('*');v[5].p(' ');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 8){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p(' ');v[7].p('*');
  }
 else if(c-'0' == 9){
   v[3].p('*');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p(' ');
  }

} 


int main(){
  string s;
  while(cin >> s){
    
    for(int i=0;i<9;i++)v[i].clear();
    for(int i=0;i<s.length();i++){
      solve(s[i]);
    }
  
    for(int i=0;i<8;i++){
      for(int j=0;j<s.length();j++){
      	cout << v[i][j];
      }
      cout << endl;
    }
  
  }
  
  
  return 0;
}

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

const int H = 8;
const int W = 5;
string s;
char G[H][W];

int main() {
  while(cin >> s) {
    while(s.size() != W) s.insert(0, "0");
    for(int i = 0; i < W; ++i) {
      int n = s[i]-'0';
      string t = "**=*****";
      t[1-n/5] = t[3+n%5] = ' ';
      for(int j = 0; j < H; ++j) {
        G[j][i] = t[j];
      }
    }
    static bool first = true;
    if(first) first = false;
    else cout << endl;
    for(int i = 0; i < H; ++i) {
      for(int j = 0; j < W; ++j) {
        cout << G[i][j];
      }
      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[] = {" ****","* ***","** **","*** *", "**** "};
	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;
	}

	exit(0);
}