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 <bits/stdc++.h>
using namespace std;
int main(void){
    std::vector<vector<string>> vec(8,vector<string>(5));
    string s;
    int flag=0;
    while (cin>>s) {
        if (flag==1) {
            cout<<endl;
        }
        if (s.size()<5) {
            int tmp=5-s.size();
            for (int hoge=0;hoge<tmp;hoge++) {
                s="0"+s;
            }
        }
        for (int i=s.size()-1;i>-1;i--) {
            if (s.at(i)=='0') {
                for (int j=0;j<8;j++) {
                    if (j==1||j==3) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='1') {
                for (int j=0;j<8;j++) {
                    if (j==1||j==4) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='2') {
                for (int j=0;j<8;j++) {
                    if (j==1||j==5) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='3') {
                for (int j=0;j<8;j++) {
                    if (j==1||j==6) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='4') {
                for (int j=0;j<8;j++) {
                    if (j==1||j==7) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='5') {
                for (int j=0;j<8;j++) {
                    if (j==0||j==3) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='6') {
                for (int j=0;j<8;j++) {
                    if (j==0||j==4) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='7') {
                for (int j=0;j<8;j++) {
                    if (j==0||j==5) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='8') {
                for (int j=0;j<8;j++) {
                    if (j==0||j==6) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            } else if (s.at(i)=='9') {
                for (int j=0;j<8;j++) {
                    if (j==0||j==7) {
                        vec.at(j).at(i)=" ";
                    } else if (j==2) {
                        vec.at(j).at(i)="=";
                    } else {
                        vec.at(j).at(i)="*";
                    }
                }
            }
        }
        for (int k=0;k<8;k++) {
            for (int l=0;l<5;l++) {
                cout<<vec.at(k).at(l);
            }
            cout<<endl;
        }
        flag=1;
    }
}

C++: #include <iostream>
#include <string>
#include <vector>

using namespace std;

char abacus[8][5];

void init() {
    for (int i = 0; i < 8; i++) {
        if (i == 2) {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = '=';
            }
        } else {
            for (int j = 0; j < 5; j++) {
                abacus[i][j] = ' ';
            }
        }
    }
}

int power(int n, int a) {
    int acc = 1;
    for (int i = 0; i < a; i++) {
        acc *= n;
    }
    return acc;
}

void set(int n) {
    for (int i = 4; 0 <= i; i--) {
        int index = 4 - i;
        int d = n / power(10, i);
//        cout << "i: " << i << endl;
//        cout << "d: " << d << endl;
        if (d < 5) {
            abacus[0][index] = '*';
            abacus[1][index] = ' ';
        } else {
            abacus[0][index] = ' ';
            abacus[1][index] = '*';
            d -= 5;
        }
        for (int j = 3; j < 8; j++) {
            abacus[j][index] = '*';
        }
        abacus[d+3][index] = ' ';
        n = n - n / power(10, i) * power(10, i);
    }
}

int main() {
    int n;
    while (cin >> n) {
        init();
        set(n);
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 5; j++) {
                cout << abacus[i][j];
            }
            cout << endl;
        }
        cout << endl;
    }
    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[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(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;
  }
}