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<string>
#include<iostream>
using namespace std;
int main() {
	string a;
	while (cin >> a) {
		int b[5], c[5],e[5];
		fill(b, b + 5, 0);
		fill(c, c + 5, 0);
		fill(e, e + 5, 4);
		for (int i = a.length() - 1; i >= 0; i--) {
			int d = (int)a[i] - '0';
			if (d >= 5) {
				b[5 - a.length() + i]++;
				d -= 5;
			}
			c[5 - a.length() + i] += d;
			e[5 - a.length() + i] -= d;
		}
		for (int i = 0; i < 5; i++) {
			if (b[i] != 0)
				cout << " ";
			else
				cout << "*";
		}
		cout << endl;
		for (int i = 0; i < 5; i++) {
			if (b[i] != 0)
				cout << "*";
			else
				cout << " ";
		}
		cout << endl;
		for (int i = 0; i < 5; i++)
			cout << "=";
		cout << endl;
		for (int i = 0; i < 5; i++) {
			for (int j = 0; j < 5; j++) {
				if (c[j] != 0) {
					cout << "*";
					c[j]--;
				}
				else if (i >= 5 - e[j]) {
					cout << "*";
				}
				else
					cout << " ";
			}
			cout << endl;
		}
	}
}

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

int main(void){
	string str;
	char aba[9][9];
	while(cin >> str){
		string str2;
		for(int i=str.size();i<5;i++){
			str2+="0";
		}
		str2+=str;
		memset(aba,'\0',sizeof(aba));
		for(int i=0;i<str2.size();i++){
			if(str2[i]>='5')aba[i][0]='*',aba[i][1]=' ';
			else aba[i][0]=' ',aba[i][1]='*';
			aba[i][2]='=';
			for(int j=3;j<8;j++){
				if(j-3==(str2[i]-'0')%5)aba[i][j]=' ';
				else aba[i][j]='*';
			}
		}
		for(int i=0;i<8;i++){
			for(int j=0;j<str2.size();j++){
				printf("%c",aba[j][i]);
			}
			printf("\n");
		}
	}
    return 0;
}

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 (cin >> n)
	{
		if (cin.eof()) break;
		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;
		}
		cout << endl;
	}
}

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

const int MAX = 5;

int len;
char num[6];
char field1[MAX][MAX], field2[2][MAX];
void change(int i) {
  
  if(num[i] % 5 == 1) { field1[1][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 2) { field1[2][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 3) { field1[3][i] = ' '; field1[0][i] = '*'; }
  if(num[i] % 5 == 4) { field1[4][i] = ' '; field1[0][i] = '*'; }
  if(num[i] >= 5) { field2[0][i] = ' '; field2[1][i] = '*'; }
}
  
int main() {
  char dumy[6];
  bool flag = 0;
  while(scanf("%s", dumy) != EOF) {
    
    //if(scanf("%s", dumy) == EOF) { break; flag = true; }
    //if(flag) cout << endl;
    memset(num, '#', sizeof(num));
    for(int i = 1 ; i < MAX ; i++)
      for(int j = 0 ; j < MAX ; j++) field1[i][j] = '*';
    
    for(int i = 0 ; i < MAX ; i++) field1[0][i] = ' ';

    for(int i = 0 ; i < MAX ; i++) {
      field2[0][i] = '*'; 
      field2[1][i] = ' ';
    }
    // cout << "OK" << endl;
    len = strlen(dumy);
    //cout << len << endl;
    len = MAX - len;
    //cout << len << endl;
    num[len] = dumy[0];
    if(len+1 < 5) num[len+1] = dumy[1];
    if(len+2 < 5) num[len+2] = dumy[2];
    if(len+3 < 5) num[len+3] = dumy[3];
    if(len+4 < 5) num[len+4] = dumy[4];
    //cout << "OK" << endl;
    for(int i = 4 ; i >= 0 ; i--) {
      if(num[i] != '#') {
	num[i] = num[i] - '0';
	change(i);
      }
    }
    
    for(int i = 0 ; i < 2 ; i++) {
      for(int j = 0 ; j < 5 ; j++) {
	cout << field2[i][j];
      }
      cout << endl;
    }
  
    cout << endl <<  "=====" << endl;
    
    for(int i = 0 ; i < 5 ; i++) {
      for(int j = 0 ; j < 5 ; j++) {
	cout << field1[i][j];
      }
      cout << endl;
    }
    cout << endl;
    memset(num, '#', sizeof(num));
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
using namespace std;
int a[5], b[5], c, cnt;
int main() {
	while (cin >> c) {
		if (cnt) { cout << endl; }
		cnt++;
		for (int i = 0; i < 5; i++) {
			a[4 - i] = (c / (int)pow(10, i)) / 2;
			b[4 - i] = (c / (int)pow(10, i)) % 5;
		}

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

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

		for (int i = 0; i < 5; i++) {
			cout << '=';
		}
		cout << endl;

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

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

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

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

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

C++: #include <cstdio>
#include <iostream>
#include <string>
#include <map>
#define rep(i, n) for (int i=0; i<n; i++)
using namespace std;

string inp, ans[8];
map<char, string> m;

int main(void)
{
	m['0'] = "* = ****";
	m['1'] = "* =* ***";
	m['2'] = "* =** **";
	m['3'] = "* =*** *";
	m['4'] = "* =**** ";
	m['5'] = " *= ****";
	m['6'] = " *=* ***";
	m['7'] = " *=** **";
	m['8'] = " *=*** *";
	m['9'] = " *=**** ";

	bool first = true;

	while (cin >> inp)
	{
		if (first)
		{
			first = false;
		} else {
			cout << endl;
		}

		ans[5] = "        ";
		ans[6] = "        ";
		ans[7] = "        ";

		while (inp.length() < 5) inp = "0" + inp;
		rep(i, 5) ans[i] = m[inp[i]];
		//rep(i, 5) cout << ans[i] << endl;
		rep(i, 5)
		{
			rep(j, 8)
			{
				if (j < 5 && i < j) continue;
				char w = ans[i][j];
				ans[i][j] = ans[j][i];
				ans[j][i] = w;
			}
		}
		rep(i, 8) cout << ans[i] << endl;
	}
	
	return 0;
}

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

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