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 <string>
#include <cstdio>
#include <cstring>

using namespace std;

int main(void)
{
	static string input[1280];
	int cnt = 0;
	
	while (cin >> input[cnt]) cnt++;
	
	string data[10];
	data[0] = "* = ****";
	data[1] = "* =* ***";
	data[2] = "* =** **";
	data[3] = "* =*** *";
	data[4] = "* =**** ";
	data[5] = " *= ****";
	data[6] = " *=* ***";
	data[7] = " *=** **";
	data[8] = " *=*** *";
	data[9] = " *=**** ";
	
	for (int i = 0; i < cnt; i++){
		char output[10][10];
		string cur = "";
		
		for (int j = 0; j < 10; j++){
			for (int k = 0; k < 10; k++){
				output[j][k] = '\0';
			}
		}
		
		for (int j = 0; j < 5 - input[i].length(); j++){
			cur += '0';
		}
		cur += input[i];
		for (int j = 0; j < cur.length(); j++){
			int p = cur[j] - '0';
			for (int k = 0; k < 8; k++){
				output[k][j] = data[p][k];
			}
		}
		for (int j = 0; j < 8; j++){
			printf("%s\n", output[j]);
		}
		if (i + 1 != cnt) cout << endl;
	}
	
	
	return 0;
}

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

const std::string s[8] = { "*****     ",
						   "     *****",
						   "==========",
						   " **** ****",
						   "* **** ***",
						   "** **** **",
						   "*** **** *",
						   "**** **** " };

int main()
{
	int n;
	while( std::cin >> n )
	{
		std::vector<int> digit;
		for( int i = 0; i != 5; ++i )
		{
			digit.push_back( n % 10 );
			n /= 10;
		}

		for( int i = 0; i != 8; ++i )
		{
			for( int j = digit.size() - 1; j >= 0; --j )
				std::cout << s[i][digit[j]];

			std::cout << std::endl;
		}

		std::cout << std::endl;
	}

	return 0;
}

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

int charToInt(char c) {
  return (int)c - (int)'0';
}

void showSoroban(string num) {
  string str = "00000";
  for(int i = 0; i < num.length(); i++) {
    str[i+5-(int)num.length()] = num[i];
  }
  for(int i = 0; i < str.length(); i++) {
    if(charToInt(str[i]) >= 5) cout << ' ';
    else                       cout << '*';
  }
  cout << endl;
  for(int i = 0; i < str.length(); i++) {
    if(charToInt(str[i]) >= 5) cout << '*';
    else                       cout << ' ';
  }
  cout << endl;
  for(int i = 0; i < str.length(); i++) cout << '=';
  cout << endl;
  for(int n = 0; n < 5; n++) {
    for(int i = 0; i < str.length(); i++) {
      if(charToInt(str[i])%5 == n) cout << ' ';
      else                         cout << '*';
    }
    cout << endl;
  }
}

int main() {
  string str;
  int i = 0;
  while(cin >> str) {
    if(i != 0) cout << endl;
    showSoroban(str);
    i++;
  }
  return 0;
}

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

char* abacusFigure[] =
{
	"* = ****",
	"* =* ***",
	"* =** **",
	"* =*** *",
	"* =**** ",
	" *= ****",
	" *=* ***",
	" *=** **",
	" *=*** *",
	" *=**** ",
};

int main()
{
	bool first = true;
	char figure[ 6 ];
	while( cin >> figure ){
		int len = strlen( figure );
		if( first ){
			first = false;
		}else{
			cout << endl;
		}
		for( int i = 0; i < 8; ++i ){
			for( int j = 0; j < len; ++j ){
				cout << abacusFigure[ figure[ j ] - '0' ][ i ];
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

char table[10][10] = {

  "* = ****",
  "* =* ***",
  "* =** **",
  "* =*** *",
  "* =**** ",
  " *= ****",
  " *=* ***",
  " *=** **",
  " *=*** *",
  " *=**** "

};

int main() {

  int n;

  char abacus[10][10];
  int digit[5];
  
  while(cin >> n) {

    digit[0]=n%100000/10000;

    digit[1]=n%10000/1000;

    digit[2]=n%1000/100;

    digit[3]=n%100/10;

    digit[4]=n%10;

    for(int i=0;i<5;i++) {

      for(int j=0;j<8;j++) {

	abacus[i][j]=table[digit[i]][j];

      }

    }

    for(int i=0;i<8;i++) {

      for(int j=0;j<5;j++) {

	cout << abacus[j][i];

      }

      cout << endl;

    }

    cout << endl;

  }

  return 0;

}

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

int main(){
	int n,c,a,i,j,count = 0;
	while(cin >> n){
		char b[8][5];
		c = 10000;
		for(i=0;i<5;i++){
			a = n/c;
			if(a<5) {
				b[0][i] = '*';
				b[1][i] = ' ';
			}
			else{
				b[0][i] = ' ';
				b[1][i] = '*';
			}
			b[2][i] = '=';
			if(a==0||a==5){
				b[3][i] = ' ';
				for(j=4;j<8;j++){
					b[j][i] = '*';
				}
			}
			else if(a==1||a==6){
				for(j=3;j<8;j++){
					if(j==4) b[j][i] = ' ';
					else b[j][i] = '*';
				}
			}
			else if(a==2||a==7){
				for(j=3;j<8;j++){
					if(j==5) b[j][i] = ' ';
					else b[j][i] = '*';
				}
			}
			else if(a==3||a==8){
				for(j=3;j<8;j++){
					if(j==6) b[j][i] = ' ';
					else b[j][i] = '*';
				}
			}
			else {
				for(j=3;j<7;j++){
					b[j][i] = '*';
				}
				b[7][i] = ' ';
			}
			n -= c*a;
			c /= 10;
		}
		if(count) printf("\n");
		else count++;
		for(i=0;i<8;i++){
			for(j=0;j<5;j++){
				cout << b[i][j];
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	string s;
	bool f=true;
	while(cin >> s){
		if(!f)cout<<"\n";
		f=false;
		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>

int main(){

	int n;
	while (std::cin >> n){

		char soro[8][5];
		for (int i = 0; i < 8; i++){
			for (int j = 0; j < 5; j++){
				soro[i][j] = '*';
			}
		}
		for (int i = 0; i < 5; i++)soro[2][i] = '=';

		for (int i = 4; i >= 0; i--){
			int mod = n % 10;

			if (mod == 0 || mod == 5)soro[3][i] = ' ';
			if (mod == 1 || mod == 6)soro[4][i] = ' ';
			if (mod == 2 || mod == 7)soro[5][i] = ' ';
			if (mod == 3 || mod == 8)soro[6][i] = ' ';
			if (mod == 4 || mod == 9)soro[7][i] = ' ';

			if (mod < 5)soro[1][i] = ' ';
			else soro[0][i] = ' ';

			n /= 10;
		}

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

	}



}

C++: #include <cstdio>
#include <cstring>
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++)
		{
			int acnt=0;
			for(int j=0; j<5; j++)
			{
				if(cnt[i]==acnt) break;
				
				if(aster[str[j]-'0'][i]) 
				{
					printf("*");
					acnt++;
				}
				else printf(" ");
			}
			puts("");
			if(i==1) puts("=====");
		}
	}
}