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 <algorithm>
#include <functional>
using namespace std;

int main() {
    while (true){
        int N;
        int num[5] = {0};
        
        cin >> N;
        
        if(N == EOF) break;
        
        num[0] = N/10000;
        N %= 10000;
        num[1] = N/1000;
        N %= 1000;
        num[2] = N/100;
        N %= 100;
        num[3] = N/10;
        N %= 10;
        num[4] = N;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] < 5) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] > 4) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            cout << "=";
        }
        cout << endl;
        
        for(int i = 0; i > 5; i++) {
            if(num[i] > 4) num[i] -= 5;
        }
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 0) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 1) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 2) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 3) cout << '*';
            else cout << " ";
        }
        
        cout << endl;
        
        for(int i = 0; i < 5; i++) {
            if(num[i] != 4) cout << '*';
            else cout << " ";
        }
        
        cout << "\n\n";
    }
    return 0;
}

C++: #include<iostream>
#include<vector>
#include<cstdio>
#define p push_back
using namespace std;
vector<char> v[10];

void solve(char c){
  if(0<=c-'0' && c-'0'<=4){
    v[0].p('*');
    v[1].p(' ');
  }
  else{
    v[0].p(' ');
    v[1].p('*');
   }
  v[2].p('=');
  if(c-'0' == 0){
    v[3].p(' ');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p('*');
  }
  else if(c-'0' == 1){
 
  v[3].p('*');v[4].p(' ');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 2){
 
  v[3].p('*');v[4].p('*');v[5].p(' ');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 3){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p(' ');v[7].p('*');

  }
 else if(c-'0' == 4){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p(' ');
  }
 else if(c-'0' == 5){
 
  v[3].p(' ');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 6){
  v[3].p('*');v[4].p(' ');v[5].p('*');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 7){
 
  v[3].p('*');v[4].p('*');v[5].p(' ');v[6].p('*');v[7].p('*');
  }
 else if(c-'0' == 8){
 
  v[3].p('*');v[4].p('*');v[5].p('*');v[6].p(' ');v[7].p('*');
  }
 else if(c-'0' == 9){
   v[3].p('*');v[4].p('*');v[5].p('*');v[6].p('*');v[7].p(' ');
  }

} 


int main(){
  string s;
  bool air = false;
  while(cin >> s){
    if(air)cout << endl;  
    air = true;
    if(s.size() < 5){
      string p = string(5-s.size(),'0') + s;
      s = p;
    }

    for(int i=0;i<9;i++)v[i].clear();
    for(int i=0;i<s.length();i++){
      solve(s[i]);
    }
  
    for(int i=0;i<8;i++){
      for(int j=0;j<s.length();j++){
      	cout << v[i][j];
      }
      cout << endl;
    }
    
  }
  
  
  return 0;
}

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

using namespace std;

int main()
{
	char n[10][9]={"* = ****","* =* ***","* =** **","* =*** *","* =**** ",
				   " *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "};
	int a;
	for(int k=0;cin>>a;k++){
		if(k>0)	cout<<endl;

		char s[6];
		sprintf(s,"%05d",a);

		char abacus[8][6];
		for(int i=0;i<5;i++){
			for(int j=0;j<8;j++){
				abacus[j][i]=n[s[i]-'0'][j];
			}
		}

		for(int i=0;i<8;i++){
			for(int j=4;j>=0;j--){
				if(abacus[i][j]!=' ')	break;
				abacus[i][j]='\0';
			}
		}

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

	return 0;
}

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

int main(){
	int input;
	int abacus[5];
	bool isFirst = true;

	while(cin >> input){
		if(!isFirst) cout << endl;

		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;
		}
		isFirst = false;
	}
}

C++: // 0128
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

void abacus(int num[]){
	for(int j=0;j<2;j++){
		for(int i=0;i<5;i++)
			if((5*j <= num[i]) && (num[i] < 5*(j+1)))
				cout<<"*";
			else
				cout<<" ";
		cout<<endl;
	}

	for(int i=0;i<5;i++)
		cout<<"=";
	cout<<endl;

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

int main(){

	int n, count = 0;
	while(scanf("%d", &n) != EOF){
		if(count != 0)
			cout<<endl;

		int num[5];
		for(int i=0;i<5;i++){
			num[4-i] = n%10;
			n /= 10;
		}
		
		abacus(num);

		count++;
	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int n,s[5];

int main(){
	bool f=0;
	while(cin>>n){
		if(f)cout<<endl;
		for(int i=0;i<5;i++)s[i]=(n/(int)pow10(4-i))%10;
		for(int i=0;i<8;i++){
			for(int j=0;j<5;j++){
				if(i==0){
					if(s[j]<5)cout<<"*";
					else cout<<" ";
				}
				if(i==1){
					if(s[j]>4)cout<<"*";
					else cout<<" ";
				}
				if(i==2)cout<<"=";
				if(i>2){
					if(s[j]%5==i-3)cout<<" ";
					else cout<<"*";
				}
			}
			cout<<endl;
		}
		f=1;
	}
}

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

#define KETA 5

using namespace std;

void Display(char abacus[KETA][9]){
	char disp[8][KETA];

	for(int i = 0; i < KETA; ++i){
		for(int j = 0; j < 8; ++j){
			disp[j][KETA - i - 1] = abacus[i][j];
		}
	}
	for(int i = 0; i < 8; i++){
		for(int j = 0; j < KETA; ++j){
			cout << disp[i][j];
		}
		cout << '\n';
	}
}
int main(void){
	bool bFirst = true;
	const char *table[] ={
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** "
	};
	while( true ){
		int n;
		char abacus[KETA][9] = {{0,},};

		cin >> n;
		cin.ignore();
		if(cin.eof())
			break;
		
		if( bFirst )
			bFirst = false;
		else
			cout << '\n';

		for(int i = 0; i < KETA; ++i){
			int k = n % 10;
			n /= 10;
			strcpy( abacus[i], table[k] ); 
		}
		Display( abacus );
	}
	return 0;
}