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

int main(void)
{
	char abacus[8][10] = {
		"*****     ",
		"     *****",
		"==========",
		" **** ****",
		"* **** ***",
		"** **** **",
		"*** **** *",
		"**** **** ",
	};
	
	int n;
	while (scanf("%d", &n) != EOF){
		int num[5];
		char a[8][5];
		for (int i = 0; i < 5; i++){
			num[4 - i] = n % 10;
			n /= 10;
		}
		for (int i = 0; i < 8; i++){
			for (int j = 0; j < 5; j++){
				a[i][j] = abacus[i][num[j]];
			}
		}
		for (int i = 0; i < 8; i++){
			for (int j = 0; j < 5; j++){
				cout << a[i][j];
			}
			cout << endl;
		}
		cout << endl;
	}
	
	return (0);
}

C++: #include<algorithm>
#include<iostream>
#include<string>
using namespace std;
int main(){
  int h=0,i;
  int len;
  for(;;){
    string s;
    cin>>s;
    if(s.empty())
      break;
    len=s.length();
    if(h)
      cout<<endl;
    h=1;
    for(i=0;i<5-len;i++)
      cout<<"*";
    for(i=0;i<len;i++){
      if((s[i]-'0')/5)
	cout<<" ";
      else
	cout<<"*";
    }
    cout<<endl;
    for(i=0;i<5-len;i++)
      cout<<" ";
    for(i=0;i<len;i++){
      if((s[i]-'0')/5)
	cout<<"*";
      else
	cout<<" ";
    }
    cout<<endl<<"====="<<endl;
    for(i=0;i<5-len;i++)
      cout<<" ";
    for(i=0;i<len;i++){
      if((s[i]-'0')%5==0)
	cout<<" ";
      else
	cout<<"*";
    }
    cout<<endl;
    for(i=0;i<5-len;i++)
      cout<<"*";
    for(i=0;i<len;i++){
      if((s[i]-'0')%5==1)
	cout<<" ";
      else
	cout<<"*";
    }
    cout<<endl;
    for(i=0;i<5-len;i++)
      cout<<"*";
    for(i=0;i<len;i++){
      if((s[i]-'0')%5==2)
	cout<<" ";
      else
	cout<<"*";
    }
    cout<<endl;
    for(i=0;i<5-len;i++)
      cout<<"*";
    for(i=0;i<len;i++){
      if((s[i]-'0')%5==3)
	cout<<" ";
      else
	cout<<"*";
    }
    cout<<endl;
    for(i=0;i<5-len;i++)
      cout<<"*";
    for(i=0;i<len;i++){
      if((s[i]-'0')%5==4)
	cout<<" ";
      else
	cout<<"*";
    }
    cout<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

string t[10]={
	"* = ****",
	"* =* ***",
	"* =** **",
	"* =*** *",
	"* =**** ",
	" *= ****",
	" *=* ***",
	" *=** **",
	" *=*** *",
	" *=**** "
};

signed main(){
	string s;
	bool f=false;
	while(cin>>s){
		if(f) cout<<endl;
		else f=true;
		string ans[6];
		while(s.size()<5) s='0'+s;
		rep(i,0,s.size()) ans[i]=t[s[i]-'0'];
		rep(i,0,8){
			rep(j,0,5){
				cout<<ans[j][i];
			}
			cout<<endl;
		}
	}
}

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

string abacus(int x){
  string res;
  if(x<5)res += "* =";
  else res += " *=";

  if(x%5 == 0)res += " ****";
  if(x%5 == 1)res += "* ***";
  if(x%5 == 2)res += "** **";
  if(x%5 == 3)res += "*** *";
  if(x%5 == 4)res += "**** ";
  return res;
}
int main(){
  int x;
  bool f = false;

  while(cin>>x){
    if(f)cout << endl;
    f = true;
    string ans[5];
    for(int i=4;i>=0;i--){
      ans[i] = abacus(x%10);
      x /= 10;
    }
 
    for(int i=0;i<8;i++){
      for(int j=0;j<5;j++)cout << ans[j][i];
      cout << endl;
    }
  }
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){

	int n,S,col;
	char table[8][6];
	bool First = true;

	while(scanf("%d",&n)!=EOF){

		if(!First)printf("\n");

		S = 10;
		for(int i=0; i < 8; i++)table[i][5] = '\0';
		col=4;

		for(int i = 0; i < 5; i++){
			switch(n%S){

			case 0:
				table[0][col] = '*';
				table[1][col] = ' ';
				table[2][col] = '=';
				table[3][col] = ' ';
				table[4][col] = '*';
				table[5][col] = '*';
				table[6][col] = '*';
				table[7][col] = '*';
				break;
			case 1:
				table[0][col] = '*';
				table[1][col] = ' ';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = ' ';
				table[5][col] = '*';
				table[6][col] = '*';
				table[7][col] = '*';
				break;
			case 2:
				table[0][col] = '*';
				table[1][col] = ' ';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = '*';
				table[5][col] = ' ';
				table[6][col] = '*';
				table[7][col] = '*';
				break;
			case 3:
				table[0][col] = '*';
				table[1][col] = ' ';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = '*';
				table[5][col] = '*';
				table[6][col] = ' ';
				table[7][col] = '*';
				break;
			case 4:
				table[0][col] = '*';
				table[1][col] = ' ';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = '*';
				table[5][col] = '*';
				table[6][col] = '*';
				table[7][col] = ' ';
				break;
			case 5:
				table[0][col] = ' ';
				table[1][col] = '*';
				table[2][col] = '=';
				table[3][col] = ' ';
				table[4][col] = '*';
				table[5][col] = '*';
				table[6][col] = '*';
				table[7][col] = '*';
				break;
			case 6:
				table[0][col] = ' ';
				table[1][col] = '*';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = ' ';
				table[5][col] = '*';
				table[6][col] = '*';
				table[7][col] = '*';
				break;
			case 7:
				table[0][col] = ' ';
				table[1][col] = '*';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = '*';
				table[5][col] = ' ';
				table[6][col] = '*';
				table[7][col] = '*';
				break;
			case 8:
				table[0][col] = ' ';
				table[1][col] = '*';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = '*';
				table[5][col] = '*';
				table[6][col] = ' ';
				table[7][col] = '*';
				break;
			case 9:
				table[0][col] = ' ';
				table[1][col] = '*';
				table[2][col] = '=';
				table[3][col] = '*';
				table[4][col] = '*';
				table[5][col] = '*';
				table[6][col] = '*';
				table[7][col] = ' ';
				break;
			}
			n /= 10;
			col--;
		}

		for(int i=0; i < 8; i++){
			printf("%s\n",table[i]);
		}

		if(First)First = false;
	}

    return 0;
}

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

int main() {
	string sa;
	int ca = 0;
	while (cin >> sa) {
		if (ca != 0)cout << endl;
		char so[5][8];
		int a = sa.size();

		for (int i = 0;i < 5;i++) {
			for (int j = 0;j < 8;j++) {
				if (j == 1 || j == 3)so[i][j] = ' ';
				else if (j == 2) { so[i][j] = '='; }
				else so[i][j] = '*';
			}
		}
	 reverse(sa.begin(), sa.end());
	 string s = sa;

		for (int i =4;i>=5-a;i--) {
			if(s[4-i]>='5'){
				so[i][0] = ' ';
				so[i][1] = '*';
			}
			else {
				so[i][0] = '*';
				so[i][1] = ' ';
			}

			if ((s[4-i] - '0') % 5 == 0) {
				so[i][3] = ' ';
				for (int ia = 4;ia <= 7;ia++)so[i][ia] = '*';
			}
			else if ((s[4-i] - '0') % 5 == 1) {
				for (int j = 3;j <= 7;j++) {
					if (j == 4)so[i][j] = ' ';
					else { so[i][j] = '*'; }
				}
			}
			else if ((s[4-i] - '0') % 5 == 2) {

				for (int j = 3;j <= 7;j++) {
					if (j == 5)so[i][j] = ' ';
					else so[i][j] = '*';
				}
			}
			else if ((s[4-i] - '0') % 5 == 3) {
				for (int j = 3;j <= 7;j++) {
					if (j == 6)so[i][j] = ' ';
					else so[i][j] = '*';
				}
			}
			else {
				for (int j = 3;j <= 7;j++) {
					if (j == 7)so[i][j] = ' ';
					else so[i][j] = '*';
				}
			}
		}
		for (int i = 0;i < 8;i++) {
			for (int j = 0;j < 5;j++) {
				cout << so[j][i];
				if (j == 4)cout << endl;
			}
		}
		ca++;
	}
	return 0;
}