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;


void abacus(int x) {
  char ans[8][6];
  for(int i=0;i<6;i++) {
    ans[0][i] = ' ';
    ans[1][i] = ' ';
    ans[2][i] = '=';
    for(int j=3;j<8;j++) {
      ans[j][i] = '*';
    }
  }
  int a[5];
  a[0] = x/10000;
  x %= 10000;
  a[1] = x/1000;
  x %= 1000;
  a[2] = x/100;
  x %= 100;
  a[3] = x/10;
  x %= 10;
  a[4] = x;
  for(int i=0;i<5;i++) {
    if(a[i] <= 4) {
      ans[0][i] = '*';
      ans[1][i] = ' ';
    }
    else {
      ans[0][i] = ' ';
      ans[1][i] = '*';
    }
    if(a[i] % 5 == 0)
      ans[3][i] = ' ';
    else if(a[i] % 5 == 1)
      ans[4][i] = ' ';
    else if(a[i] % 5 == 2)
      ans[5][i] = ' ';
    else if(a[i] % 5 == 3)
      ans[6][i] = ' ';
    else if(a[i] % 5 == 4)
      ans[7][i] = ' ';
  }
  for(int i=0;i<8;i++) {
    for(int j=0;j<5;j++) {
      cout << ans[i][j];
    }
    cout << endl;
  }

}

int main() {
  int x;
  bool r=false;
  while(cin >> x) {
    if(r)cout << endl;
    abacus(x);
    r=true;
  }
}

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

const char PATTERN[10][9] = {
	"* = ****", "* =* ***", "* =** **", "* =*** *", "* =**** ",
	" *= ****", " *=* ***", " *=** **", " *=*** *", " *=**** "};

int main()
{
	std::string input;
	int loops = 0;
	while (getline(std::cin, input)) {
		int n = input.length();
		char abacus[5][9];
		
		for (int i=0; i<5-n; i++) strcpy(abacus[i], PATTERN[0]);
		for (int i=0; i<n; i++) {
			int d = input[i] - '0';
			strcpy(abacus[i+5-n], PATTERN[d]);
		}
		if (loops>0) std::cout << std::endl;
		
		for (int j=0; j<8; j++) {
			for (int i=0; i<5; i++) {
				std::cout << abacus[i][j];
			}
			std::cout << std::endl;
		}
		
		loops++;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	char ball[10][8] = {{'*',' ','=',' ','*','*','*','*'},
											{'*',' ','=','*',' ','*','*','*'},
											{'*',' ','=','*','*',' ','*','*'},
											{'*',' ','=','*','*','*',' ','*'},
											{'*',' ','=','*','*','*','*',' '},
											{' ','*','=',' ','*','*','*','*'},
											{' ','*','=','*',' ','*','*','*'},
											{' ','*','=','*','*',' ','*','*'},
											{' ','*','=','*','*','*',' ','*'},
											{' ','*','=','*','*','*','*',' '}};
	string i;
	while(cin >> i,!cin.eof()){
	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;
	}
	cout << endl;
	}
}

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

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}


string s;
int n;
int A[6];
int B[6];
char T[8][6];

void solve() {
    for ( int i = 0; i < 8; ++ i ) {
        for ( int j = 0; j < 5; ++ j ) {
            T[i][j] = '*';
        }
        T[i][5] = '\0';
    }
    for ( int i = 0; i < 5; ++ i ) {
        T[2][i] = '=';
    }

    for ( int i = 0; i < n; ++ i ) {
        int k = s[i] - '0';
        if ( k >= 5 ) A[i] = 0;
        else A[i] = 1;
        B[i] = k % 5;
    }

    for ( int i = 0; i < n; ++ i ) {
        T[A[i]][i] = ' ';
        T[3+B[i]][i] = ' ';
    }
}

void output() {
    for ( int i = 0; i < 8; ++ i ) {
        cout << T[i] << endl;
    }
}

string addPrefix( string s ) {
    while ( s.size() < 5 ) {
        s = "0" + s;
    }
    return s;
}

int main() {
    bool flag = true;
    while ( cin >> s ) {
        if ( ! flag ) cout << endl;
        flag = false;
        s = addPrefix(s);
        n = s.size();
        solve();
        output();
    }
    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]==1)
				  data[4][i]=0;
			  else if(gedan[i]==1)
				  data[5][i]=0;
			  else if(gedan[i]==1)
				  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;
}

C++: #include<stdio.h>

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

	while(1){
		if(k!=0) printf("\n");
		k++;
		if(scanf("%d",&n)==EOF)break;
		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<iostream>
using namespace std;

int main()
{
    int n;
    char a[8][10], b[8][5];
    for( int i = 0; i < 8; i++ )
        for( int j = 0; j < 10; j++ )
            a[i][j] = '*';

    for( int i = 0; i < 8; i++ )
        for( int j = 0; j < 10; j++ )
        {
            a[2][j] = '=';
            if( j / 5 == 1 )
                a[0][j] = ' ';
            else
                a[1][j] = ' ';
        }

    for( int i = 3; i < 8; i++ )
    {
        a[i][i-3] = ' ';
        a[i][i+2] = ' ';
    }

    bool judge = false;
    while( cin >> n )
    {
        if( judge )
            cout << endl;

        int c = 5;
        while( c-- )
        {
            for( int i = 0; i < 8; i++ )
                b[i][c] = a[i][n%10];
            n /= 10;
        }
        for( int i = 0; i < 8; i++ )
        {
            for( int j = 0; j < 5; j++ )
                cout << b[i][j];
            cout << endl;
        }
        judge = true;
    }
    return 0;
}