Go: package main

import (
	"bufio"
	"fmt"
		"os"
	"strconv"
	"strings"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [10]string{
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** ",
	}
	input := make([]string, 0)
	for scanner.Scan() {
		input = append(input, scanner.Text())
	}
	n := len(input)
	cnt := 0
	for cnt < n {
		tmp := strings.Split(fmt.Sprintf("%05s", input[cnt]), "")
		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()
		}
		if cnt != n-1 {
			fmt.Println()
		}
		cnt++
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	char ball[10][8] = {{'*',' ','=',' ','*','*','*','*'},
											{'*',' ','=','*',' ','*','*','*'},
											{'*',' ','=','*','*',' ','*','*'},
											{'*',' ','=','*','*','*',' ','*'},
											{'*',' ','=','*','*','*','*',' '},
											{' ','*','=',' ','*','*','*','*'},
											{' ','*','=','*',' ','*','*','*'},
											{' ','*','=','*','*',' ','*','*'},
											{' ','*','=','*','*','*',' ','*'},
											{' ','*','=','*','*','*','*',' '}};
	string i;
	cin >> i;
	for(int j=0;j<5-i.size();j++)i = '0' + i;
	for(int k=0;k<8;k++){
		for(int l=0;l<5;l++){
			cout << ball[l][k];
		}
		cout << endl;
	}
}

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

using namespace std;

const string abacus[] = {"* = ****",
                         "* =* ***",
                         "* =** **",
                         "* =*** *",
                         "* =**** ",
                         " *= ****",
                         " *=* ***",
                         " *=** **",
                         " *=*** *",
                         " *=**** "};
const int height = 8;

int main()
{
    string s;
    bool flag = false;
    int index;

    while (cin >> s) {
        if (flag)
            putchar('\n');

        while (s.size() < 5)
            s = '0' + s;

        for (int i = 0; i < height; i++) {
            for (int j = 0; j < s.size(); j++) {
                index = (int)(s[j] - '0');
                putchar(abacus[index][i]);
            }
            putchar('\n');
        }
        flag = true;
    }

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  string s;
  bool flag=false;
  while(cin>> s){
    int ban[8][5]={0}; //0が空白,1がアスタリスク,2が=
    for(int i=0;i<8;i++){
      if(i==0 || i==4 || i==5 || i==6 || i==7){
	for(int j=0;j<5;j++){
	  ban[i][j]=1;
	}
      }
      else if(i==2){
	for(int j=0;j<5;j++){
	  ban[i][j]=2;
	}
      }
    }

    for(int i=0;i<s.size();i++){
      int x=i+(5-s.size());
      if(s[i]=='1'){
	ban[3][x]=1; ban[4][x]=0;
      }
      else if(s[i]=='2'){
	ban[3][x]=1; ban[5][x]=0;
      }
      else if(s[i]=='3'){
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='4'){
	ban[3][x]=1; ban[7][x]=0;
      }
      else if(s[i]=='5'){
	ban[1][x]=1; ban[0][x]=0;
      }
      else if(s[i]=='6'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[4][x]=0;
      }
      else if(s[i]=='7'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[5][x]=0;
      }
      else if(s[i]=='8'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='9'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[7][x]=0;
      }
    }
    if(flag)
      cout<< endl;
    for(int i=0;i<8;i++){
      for(int j=0;j<5;j++){
	//cout<< ban[i][j];
	if(ban[i][j]==0) cout<< " ";
	else if(ban[i][j]==1) cout<< '*';
	else if(ban[i][j]==2) cout<< '=';
      }
      cout<< endl;
    }
    flag=true;
  }
}

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

int main(){
	int n;
	int pow10[]={10000,1000,100,10,1};
	while(!(cin>>n&&n))return 0;
	while(1){
		for(int i=0;i<2;i++){
			for(int j=0;j<5;j++){
				if(i==(5<=n/pow10[j]%10))cout<<'*';
				else cout<<' ';
			}
			cout<<endl;
		}
		cout<<"=====\n";
		for(int i=0;i<5;i++){
			for(int j=0;j<5;j++){
				if(n/pow10[j]%5==i)cout<<' ';
				else cout<<'*';
			}
			cout<<endl;
		}
		if(cin>>n&&n)cout<<endl;
	}
	return 0;
}

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

const int MAX = 5;

int len;
char num[MAX];
char field1[MAX][MAX], field2[2][MAX];
void change(int i) {
  
  if(num[i] % 5 == 1) { field1[1][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 2) { field1[2][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 3) { field1[3][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 4) { field1[4][i] = ' '; field1[0][i] = '*'; }
  if(num[i] >= 5) { field2[0][i] = ' '; field2[1][i] = '*'; }
  
}
  
int main() {
  char dumy[MAX];
  while(scanf("%s", dumy) != EOF) {
    
    memset(num, '#', sizeof(num));
    
    for(int i = 1 ; i < MAX ; i++)
      for(int j = 0 ; j < MAX ; j++) field1[i][j] = '*';
    
    for(int i = 0 ; i < MAX ; i++) field1[0][i] = ' ';

    for(int i = 0 ; i < MAX ; i++) {
      field2[0][i] = '*'; 
      field2[1][i] = ' ';
    }

    len = strlen(dumy);
    len = MAX - len;
    num[len] = dumy[0];
    if(len+1 < 5) num[len+1] = dumy[1];
    if(len+2 < 5) num[len+2] = dumy[2];
    if(len+3 < 5) num[len+3] = dumy[3];
    if(len+4 < 5) num[len+4] = dumy[4];

    for(int i = 4 ; i >= 0 ; i--) {
      if(num[i] != '#') {
	num[i] = num[i] - '0';
	change(i);
      }
    }
    
    for(int i = 0 ; i < 2 ; i++) {
      for(int j = 0 ; j < 5 ; j++) {
	cout << field2[i][j];
      }
      cout << endl;
    }
    cout << "=====" << endl;
    
    for(int i = 0 ; i < 5 ; i++) {
      for(int j = 0 ; j < 5 ; j++) {
	cout << field1[i][j];
      }
      cout << endl;
    }
    cout << endl;
    memset(num, '#', sizeof(num));
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  string s;
  int cnt=0;
  while(cin>> s){
    int ban[8][5]={0}; //0が空白,1がアスタリスク,2が=
    for(int i=0;i<8;i++){
      if(i==0 || i==4 || i==5 || i==6 || i==7){
	for(int j=0;j<5;j++){
	  ban[i][j]=1;
	}
      }
      else if(i==2){
	for(int j=0;j<5;j++){
	  ban[i][j]=2;
	}
      }
    }

    for(int i=0;i<s.size();i++){
      int x=i+(5-s.size());
      if(s[i]=='1'){
	ban[3][x]=1; ban[4][x]=0;
      }
      else if(s[i]=='2'){
	ban[3][x]=1; ban[5][x]=0;
      }
      else if(s[i]=='3'){
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='4'){
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='5'){
	ban[1][x]=1; ban[0][x]=0;
      }
      else if(s[i]=='6'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[4][x]=0;
      }
      else if(s[i]=='7'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[5][x]=0;
      }
      else if(s[i]=='8'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[6][x]=0;
      }
      else if(s[i]=='9'){
	ban[1][x]=1; ban[0][x]=0;
	ban[3][x]=1; ban[6][x]=0;
      }
    }
    if(cnt) cout<< endl;
    cnt++;
    for(int i=0;i<8;i++){
      for(int j=0;j<5;j++){
	//cout<< ban[i][j];
	if(ban[i][j]==0) cout<< " ";
	else if(ban[i][j]==1) cout<< '*';
	else if(ban[i][j]==2) cout<< '=';
      }
      cout<< endl;
    }
  }
}

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

char n[10][12]={
	"* = ****","* =* ***","* =** **","* =*** *","* =**** ",
	" *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "
};

int main(void){
	int i,j,set,x;
	char s[8];

	for(set=0;cin>>x && x;set++){
		if(set!=0) cout<<endl;
		sprintf(s,"%05d",x);

		for(i=0;i<8;i++){
			for(j=0;j<5;j++){
				cout<<n[s[j]-'0'][i];
			}
			cout<<endl;
		}
	}

	return 0;
}