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(){
	string s;
	while(cin >> s){
		string soroban[8];
		int n[5]={0};
		for(int i=0;i<8;++i)soroban[i]="";
		for(int i=5-s.size();i<5;++i)if('0'<=s[i-(5-s.size())]&&s[i-(5-s.size())]<='9')n[i]=s[i-(5-s.size())]-'0';
		for(int i=0;i<5;++i){
			soroban[0]+=(n[i]/5)?' ':'*';
			soroban[1]+=(n[i]/5)?'*':' ';
			soroban[2]+='=';
			for(int j=0;j<5;++j) soroban[3+j]+=(n[i]%5==j)?' ':'*';
		}
		for(int i=0;i<8;++i)cout << soroban[i] << "\n";
	}
	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
string num[10]={
	"* = ****",
	"* =* ***",
	"* =** **",
	"* =*** *",
	"* =**** ",
	" *= ****",
	" *=* ***",
	" *=** **",
	" *=*** *",
	" *=**** ",
};
int main()
{
    int n;
	int a[5];
	bool first=true;
	while(cin>>n){
		if(!first)cout<<endl;
		a[0]=n/10000;
		a[1]=(n/1000)%10;
		a[2]=(n/100)%10;
		a[3]=(n/10)%10;
		a[4]=n%10;
		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				cout<<num[a[j]][i];
			}
			cout<<endl;
		}
	}
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const double EPS = 1e-10;

signed main() {
	string s;
	while (cin >> s) {
		while (s.size() < 5)s = "0" + s;
		vector<string>v(8, "     ");
		v[2] = "=====";
		rep(i, 0, 5) {
			rep(j, 0, 8) {
				switch (j)
				{
				case 0:
					if ('0' <= s[i] && s[i] <= '4')v[j][i] = '*';
					break;
				case 1:
					if ('5' <= s[i] && s[i] <= '9')v[j][i] = '*';
					break;
				case 2:
					break;
				case 3:
					if (s[i] != '0'&&s[i] != '5')v[j][i] = '*';
					break;
				case 4:
					if (s[i] != '1'&&s[i] != '6')v[j][i] = '*';
					break;
				case 5:
					if (s[i] != '2'&&s[i] != '7')v[j][i] = '*';
					break;
				case 6:
					if (s[i] != '3'&&s[i] != '8')v[j][i] = '*';
					break;
				case 7:
					if (s[i] != '4'&&s[i] != '9')v[j][i] = '*';
					break;
				default:
					break;
				}
			}
		}
		rep(i, 0, 8)cout << v[i] << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;

int main(){
	string S,a[10] = {"* = ****","* =* ***","* =** **","* =*** *","* =****"," *= ****"," *=* ****"," *=** **"," *=*** *"," *=****"};
	while(cin>>S){
		while(S.size()<5) S = "0"+S;
		for(int i=0;i<8;i++){
			for(int j=0;j<S.size();j++){
				printf("%c",a[S[j]-'0'][i]);
			}puts("");
		}
	}
	return 0;
}

C++: #include<iostream>

void makeabacus(char abacus[8][5],int num,int c);
void output(char abacus[8][5]);

int main()
{
	char abacus[8][5];
	
	while(1)
	{
		int num;
		std::cin>>num;
		if(std::cin.eof())break;
		
		for(int i=4;i>=0;i--)
		{
			int digit=num%10;
			num/=10;
			makeabacus(abacus,digit,i);
		}
		output(abacus);
	}
	return 0;
}

void makeabacus(char abacus[8][5],int num,int c)
{
	int q=num/5;
	int s=num%5;
	int i=0;
	if(q==1)
	{
		abacus[0][c]=' ';
		abacus[1][c]='*';
	}
	else
	{
		abacus[0][c]='*';
		abacus[1][c]=' ';
	}
	abacus[2][c]='=';
	
	for(i=3;i<3+s;i++)
	{
		abacus[i][c]='*';
	}
	abacus[i++][c]=' ';
	for(;i<8;i++)
	{
		abacus[i][c]='*';
	}
}

void output(char abacus[8][5])
{
	for(int i=0;i<8;i++)
	{
		for(int j=0;j<5;j++)
		{
			std::cout<<abacus[i][j];
		}
		std::cout<<std::endl;
	}
	std::cout<<std::endl;

}

C++: #include<stdio.h>

int main(void){
	int n,i,j;
	int joudan[5],gedan[5];
	int data[7][5];

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

		for(i=0;i<7;i++)
			for(j=0;j<5;j++)
				data[i][j]=1;

		for(i=4;i>=0;i--){
			joudan[i]=(n%10)/5;
			gedan[i]=(n%10)%5;
			n/=10;
		}
		  for(i=0;i<5;i++){//上段の判定
			  if(joudan[i]==1)
				  data[0][i]=0;
			  else 
				  data[1][i]=0;
		  }

		 for(i=0;i<5;i++){
			  if(gedan[i]==0)
				 data[2][i]=0;
			  else if(gedan[i]==1)
				  data[3][i]=0;
			  else if(gedan[i]==2)
				  data[4][i]=0;
			  else if(gedan[i]==3)
				  data[5][i]=0;
			  else if(gedan[i]==4)
				  data[6][i]=0;
		  }
		for(i=0;i<2;i++)
			for(j=0;j<5;j++){
				if(data[i][j]==1)
					printf("*");
				else
					printf(" ");
				if(j==4) printf("\n");
			}

		for(i=0;i<5;i++){
			printf("=");
			if(i==4) printf("\n");
		}

		for(i=2;i<7;i++)
			for(j=0;j<5;j++){
				if(data[i][j]==1)
					printf("*");
				else
					printf(" ");
				if(j==4) printf("\n");
			}
			printf("\n");
	}
	return 0;
}