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

int main(){
	int input;
	int abacus[5];

	while(cin >> input){
		for(int i=0; i< 5; i++){
			abacus[4-i] = input% 10;
			input/= 10;
		}

		for(int i=0; i < 5; i++){
			if(abacus[i] < 5) cout << '*';
			else cout << " ";
		}
		cout << endl;

		for(int i=0; i< 5; i++){
			if(abacus[i] < 5){
				cout << " ";
			}
			else{
				cout << "*";
				abacus[i]-= 5;
			}
		}
		cout << endl;

		cout << "=====" << endl;

		for(int i=0; i < 5; i++){
			for(int j=0; j < 5; j++){
				if(abacus[j] == 0) cout << " ";
				else cout << "*";

				abacus[j]--;
			}
			cout << endl;
		}
	}
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
long n,i,d[5],f[5];
string s;
while(cin>>n){
for(i=4;i>=0;i--){d[i]=n%10;n/=10;}
s="";for(i=0;i<5;i++){if(d[i]<5)s+='*';else s+=' ';}cout<<s<<endl;
s="";for(i=0;i<5;i++){if(d[i]>4)s+='*';else s+=' ';}cout<<s<<endl;
cout<<"====="<<endl;
for(i=0;i<5;i++){d[i]%=5;f[i]=0;}
s="";for(i=0;i<5;i++){if(f[i]==1||d[i]>0)s+='*';else{s+=' ';f[i]=1;}}cout<<s<<endl;
s="";for(i=0;i<5;i++){if(f[i]==1||d[i]>1)s+='*';else{s+=' ';f[i]=1;}}cout<<s<<endl;
s="";for(i=0;i<5;i++){if(f[i]==1||d[i]>2)s+='*';else{s+=' ';f[i]=1;}}cout<<s<<endl;
s="";for(i=0;i<5;i++){if(f[i]==1||d[i]>3)s+='*';else{s+=' ';f[i]=1;}}cout<<s<<endl;
s="";for(i=0;i<5;i++){if(f[i]==1||d[i]>4)s+='*';else{s+=' ';f[i]=1;}}cout<<s<<endl;
cout<<endl;
}
return 0;
}

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

int main()
{
	bool aster[10][7]={0};
	for(int i=0; i<10; i++)
	{
		if(i<=4) aster[i][0]=1;
		else aster[i][1]=1;
	}
	
	for(int i=0; i<5; i++)
	for(int j=0; j<10; j++)
		if(i!=(j%5)) aster[j][i+2]=1;
	
	bool f=false;
	char buf[9];
	while(scanf("%s", buf) != EOF)
	{
		if(f) puts("");
		f=true;
		
		char str[9];
		int cnt[7]={0}, len=strlen(buf);
		for(int i=0; i<5; i++)
		{
			if(5-len<=i) str[i]=buf[i-(5-len)];
			else str[i]='0';
		}
		str[5]='\0';
		
		for(int i=0; i<7; i++)
		for(int j=0; j<5; j++)
		{
			if(aster[str[j]-'0'][i]) cnt[i]++;
		}
		
		for(int i=0; i<7; i++)
		{
			for(int j=0; j<5; j++)
			{
				if(cnt[i]==0) break;
				
				if(aster[str[j]-'0'][i]) printf("*");
				else printf(" ");
			}
			puts("");
			if(i==1) puts("=====");
		}
	}
}

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

void abacus(int n);


int main(void){
  int n;
  bool st=true;
  while(cin>>n){
    if(st==false){
      cout<<endl;
    }
    abacus(n);
    st=false;
  }
  return 0;
}

void abacus(int n){
  int keta[5]={n/10000,(n%10000)/1000,(n%1000)/100,(n%100)/10,n%10};

  for(int i=0;i<5;i++){
    if(keta[i]>=5){
      cout<<" ";
    }
    else{
      cout<<"*";
    }
  }
  cout<<endl;

  for(int i=0;i<5;i++){
    if(keta[i]<5){
      cout<<" ";
    }
    else{
      cout<<"*";
      keta[i]-=5;
    }
  }
  cout<<endl;

  cout<<"====="<<endl;

  for(int i=0;i<5;i++){
    if(keta[i]==0){
      cout<<" ";
    }
    else{
      cout<<"*";
    }
  }
  cout<<endl;

  for(int i=0;i<5;i++){
    if(keta[i]==1){
      cout<<" ";
    }
    else{
      cout<<"*";
    }
  }
  cout<<endl;

  for(int i=0;i<5;i++){
    if(keta[i]==2){
      cout<<" ";
    }
    else{
      cout<<"*";
    }
  }
  cout<<endl;

  for(int i=0;i<5;i++){
    if(keta[i]==3){
      cout<<" ";
    }
    else{
      cout<<"*";
    }
  }
  cout<<endl;

  for(int i=0;i<5;i++){
    if(keta[i]==4){
      cout<<" ";
    }
    else{
      cout<<"*";
    }
  }
  cout<<endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main()
{
	char s[6], r[5][8], d;
	int n, i, j, c, b = 0;
	while (1)
	{
		if (cin.eof()) break;
		cin >> n;
		if (b) cout << endl;
		sprintf(s, "%05d", n);
		for (i = 0; i < 5; i++)
		{
			d = (char)s[i];
			c = atoi(&d);
			if (c < 5)
			{
				r[i][0] = '*';
				r[i][1] = ' ';
			}
			else
			{
				r[i][0] = ' ';
				r[i][1] = '*';
			}
			r[i][2] = '=';
			for (j = 3; j < 8; j++)
			{
				if (c != j-3 && c != j+2)
					r[i][j] = '*';
				else
					r[i][j] = ' ';
			}
		}
		for (i = 0; i < 8; i++)
		{
			for (j = 0; j < 5; j++)
			{
				cout << r[j][i];
			}
			cout << endl;
		}
		b++;
	}
}

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

using namespace std;

int main(){
  int i, j, n, m, count=0, data[5];
  string abacus[10];

  abacus[0] = "* = ****";
  abacus[1] = "* =* ***";
  abacus[2] = "* =** **";
  abacus[3] = "* =*** *";
  abacus[4] = "* =**** ";
  abacus[5] = " *= ****";
  abacus[6] = " *=* ***";
  abacus[7] = " *=** **";
  abacus[8] = " *=*** *";
  abacus[9] = " *=**** ";

  while(cin >> n){
    if(count != 0)
      cout << endl;

    for(i=0, j=10000; i<5; ++i, j/=10){
      m = n/j;
      n = n - m*j;
      data[i] = m;
    }

    for(i=0; i<8; ++i){
      for(j=0; j<5; ++j){
	cout << abacus[data[j]][i];
      }
      cout << endl;
    }
    ++count;
  }
  return 0;
}

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");
			}
	}
	return 0;
}

C++: #include <vector>
#include <map>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 10000000;
using namespace std;
typedef long long  ll;
/** Problem0128 : Abacus **/
int main()
{
	string list[10];
	list[0] = "* = ****";
	list[1] = "* =* ***";
	list[2] = "* =** **";
	list[3] = "* =*** *";
	list[4] = "* =**** ";
	list[5] = " *= ****";
	list[6] = " *=* ***";
	list[7] = " *=** **";
	list[8] = " *=*** *";
	list[9] = " *=**** ";
	
	string n;
	string ans[5];
	bool first=true;
	
	while (cin>>n) {
		rep(i, 5) ans[i] = list[0];
		rep(i, n.length()) {
			ans[5-n.length()+i] = list[n[i]-'0'];
		}

		if (first) {
			first = false;
		} else {
			cout << endl;
		}
		rep(x, 8) {
			rep(y, 5) {
				cout << ans[y][x];
			}
			cout << endl;
		}
	}
}