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 <stdio.h>
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <fstream>
#include <sstream>
#include <math.h>
#include <queue>
#include <stack>
#include <math.h>

using namespace std;

char soroban_table[8][10]={
    '*','*','*','*','*',' ',' ',' ',' ',' ',
    ' ',' ',' ',' ',' ','*','*','*','*','*',
    '=','=','=','=','=','=','=','=','=','=',
    ' ','*','*','*','*',' ','*','*','*','*',
    '*',' ','*','*','*','*',' ','*','*','*',
    '*','*',' ','*','*','*','*',' ','*','*',
    '*','*','*',' ','*','*','*','*',' ','*',
    '*','*','*','*',' ','*','*','*','*',' '
};

/*
*****
     *****
==========
 **** ****
* **** ***
** **** **
*** **** *
**** ****
*/
int main(){
    string input;
    while(cin >> input){
        while(input.length()<5){
            input='0'+input;
        }
        for(int i=0; i<8; i++){
            for(int j=0; j<input.length(); j++){
                cout<<soroban_table[i][input[j]-'0'];
            }
            cout<<endl;
        }
        cout<<endl;
    }
}

C++: #include<stdio.h>
#include<string>
#include<iostream>
using namespace std;

int main(){
string str;

char ch[10][6];
char n1[10]="* =* ***";
char n2[10]="* =** **";
char n3[10]="* =*** *";
char n4[10]="* =**** ";
char n5[10]=" *= ****";
char n6[10]=" *=* ***";
char n7[10]=" *=** **";
char n8[10]=" *=*** *";
char n9[10]=" *=**** ";
char n0[10]="* = ****";
char nn[10];

while(cin>>str){
int t=5-str.size();

for(int i=0;i<5;i++){
	if(i<t){		
	for(int j=0;j<9;j++)
	nn[j]=n0[j];
}
	else{

char y=str[i-t];


if(y=='0'){
	for(int j=0;j<9;j++)
	nn[j]=n0[j];
}
else if(y=='1'){
	for(int j=0;j<9;j++)nn[j]=n1[j];
}
else if(y=='2'){
	for(int j=0;j<9;j++)nn[j]=n2[j];
}
else if(y=='3'){
	for(int j=0;j<9;j++)nn[j]=n3[j];
}
else if(y=='4'){
	for(int j=0;j<9;j++)nn[j]=n4[j];
}
else if(y=='5'){
	for(int j=0;j<9;j++)nn[j]=n5[j];
}
else if(y=='6'){
	for(int j=0;j<9;j++)nn[j]=n6[j];
}
else if(y=='7'){
	for(int j=0;j<9;j++)nn[j]=n7[j];
}
else if(y=='8'){
	for(int j=0;j<9;j++)nn[j]=n8[j];
}
else if(y=='9'){
	for(int j=0;j<9;j++)nn[j]=n9[j];
}}

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

ch[j][i]=nn[j];

}
	
}

for(int i=0;i<8;i++){
for(int j=0;j<5;j++)
cout<<ch[i][j];

cout<<endl;
}
cout<<endl;
}
return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define r(i,n) for(int i=0;i<n;i++)
main(){
  int i=0;
  string s;
  while(cin>>s){
    string t[8];
    r(ii,5){
      r(j,8){
        if(j==2)t[j]+='=';
        else t[j]+='*';
      }
    }
    for(i=0;i<5-s.size();i++)
      t[1][i]=t[3][i]=' ';
    for(;i<5;i++){
      int p=s[i-(5-s.size())]-'0';
      if(p==0)t[1][i]=t[3][i]=' ';
      if(p==1)t[1][i]=t[4][i]=' ';
      if(p==2)t[1][i]=t[5][i]=' ';
      if(p==3)t[1][i]=t[6][i]=' ';
      if(p==4)t[1][i]=t[7][i]=' ';
      if(p==5)t[0][i]=t[3][i]=' ';
      if(p==6)t[0][i]=t[4][i]=' ';
      if(p==7)t[0][i]=t[5][i]=' ';
      if(p==8)t[0][i]=t[6][i]=' ';
      if(p==9)t[0][i]=t[7][i]=' ';
    }
    r(ii,8)cout<<t[ii]<<endl;
  }
}

C++: #include<iostream>
#include<string>
using namespace std;
string s[10]={"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "};
int main(){
	string d;
	int c[5];
	bool first=true;
	while(cin>>d){
		if(!first)cout<<endl;
		first=false;
		for(int i=0;i<5;i++)c[i]=0;
		for(int i=0;i<d.size();i++)c[5-d.size()+i]=d[i]-'0';
		for(int i=0;i<8;i++){for(int j=0;j<5;j++)cout<<s[c[j]][i];cout<<endl;}
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int main()
{
	string str;
	int flag = 0;
	while(cin >> str)
	{
		if(flag++ != 0) cout << endl;
		deque<string> res;

		rep(i, 5)
		{
			if(str.size() <= i)
				res.push_front("* = ****");
			else
			{
				if(str[i] - '0' < 5)
					res.push_back("* =");
				else
				{
					str[i] -= 5;
					res.push_back(" *=");
				}

				rep(j, str[i] - '0')
					res[i] += "*";

				res[i] += " ";

				rep(j, 5 - (str[i] - '0' + 1))
					res[i] += "*";
			}
		}

		rep(i, 8) rep(j, 5)
			cout << res[j][i] << (j == 4 ? "\n" : "");
	}
}

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

char* abacusFigure[] =
{
	"* = ****",
	"* =* ***",
	"* =** **",
	"* =*** *",
	"* =**** ",
	" *= ****",
	" *=* ***",
	" *=** **",
	" *=*** *",
	" *=**** ",
};

int main()
{
	bool first = true;
	char input[ 6 ];
	while( cin >> input ){
		char figure[ 6 ];
		int len = strlen( input );
		for( int i = 0; i < 5 - len; ++i ){
			figure[ i ] = '0';
		}
		for( int i = 0; i < len; ++i ){
			figure[ 5 - len + i ] = input[ i ];
		}
		figure[ 6 ] = '\0';

		if( first ){
			first = false;
		}else{
			cout << endl;
		}
		for( int i = 0; i < 8; ++i ){
			for( int j = 0; j < 5; ++j ){
				cout << abacusFigure[ figure[ j ] - '0' ][ i ];
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
main(){
string b[] = {"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "},i;
int f=0,k,l;
while(cin>>i,!cin.eof()){
f&&cout<<endl;
f?:f=1;
while(i.size()<5)i='0'+i;
for(k=0;k<8;k++){
for(l=0;l<5;l++)cout<<b[i[l]-'0'][k];
cout<<endl;
}
}
}

C++: #include <iostream>
using namespace std;
int main(){
	string b[] = {"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "},i;
	int f = 0, k, l;
	while(cin >> i,!cin.eof()){
		f&&cout<<endl;
		f?:f=1;
		while(i.size() < 5)i = '0' + i;
		for(k=0;k<8;k++){
			for(l=0;l<5;l++)cout << b[i[l]-'0'][k];
			cout << endl;
		}
	}
}

C++: #include <iostream>

using namespace std;

string str[10],in;

void init(){
  str[0] = "* = ****";
  str[1] = "* =* ***";
  str[2] = "* =** **";
  str[3] = "* =*** *";
  str[4] = "* =**** ";
  str[5] = " *= ****";
  str[6] = " *=* ***";
  str[7] = " *=** **";
  str[8] = " *=*** *";
  str[9] = " *=**** ";
}

void solve(string s,int count){
  if(count) cout << endl;

  int len = (int)s.size();
  string ans[5];  

  if(len == 5){
    for(int i = 0 ; i < len ; i++)
      ans[i] = str[s[i]-'0'];
  }
  else{
    for(int i = 0 ; i < 5-len ; i++){
      ans[i] = str[0];
    }
  
    int t = 0;
    for(int i = 5-len ; i < 5 ; i++)
      ans[i] = str[s[t++]-'0'];
  }

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

int main(){
  init();

  int count = 0;
  while(cin >> in){
    solve(in,count);
    count++;
  }

  return 0;
}