This is a creation in Article, where the information may have evolved or changed. Copyright leaked 2010-12 Qtrac Ltd.
//
This program or package and any associated files is licensed under the
Apache License, Version 2.0 (the "License"); These files
Except in compliance with the License. You can get a copy of the License
at:http://www.apache.org/licenses/license-2.0.
//
Unless required by applicable law or agreed to writing, software
Distributed under the License is distributed on a "as is" BASIS,
Without warranties or CONDITIONS of any KIND, either express or implied.
See the License for the specific language governing permissions and
Limitations under the license.// uses the repeat function in the strings package
Package Main
Import (
"FMT"
"Log"
"OS"
"Path/filepath"
"Strings"
)
Func Main () {
If Len (OS. Args) = = 1 {
Fmt. Printf ("Usage:%s <whole-number>\n", filepath. Base (OS. Args[0]))
Os. Exit (1)
}
Stringofdigits: = os. ARGS[1]
Add ****** to use the repeat function in the strings package
Fmt. PRINTLN (Strings. Repeat ("*", Len (stringofdigits) *6))
/* for I: = 0; I < Len (stringofdigits) *6; i++ {
Fmt. Print ("*")
}
Fmt. Print ("\ n") */
For row: = Range Bigdigits[0] {
Line: = ""
For _, Digit: = Range Stringofdigits {
Digit-= ' 0 '
If 0 <= digit && digit <= 9 {
Line + = Bigdigits[digit][row] + " "
} else {
Log. Fatal ("Invalid whole number")
}
}
Fmt. Println (line)
}
For I: = 0; I < Len (stringofdigits) *6; i++ {
Fmt. Print ("*")
}
Fmt. Print ("\ n")
}
var bigdigits = [][]string{
{" to",
"0 0",
"0 0",
"0 0",
"0 0",
"0 0",
" to"},
{"1", "11", "1", "1", "1", "1", "111"},
{"222", "2 2", " 2", " 2 ", "2 ", "2 ", "22222"},
{"333", "3 3", " 3", "All" , " 3", "3 3", "333"},
{" 4 ", "4", " 4 ", "4 4 ", "444444", " 4 ",
" 4 "},
{"55555", "5 ", "5 ", "555", " 5", "5 5", "555"},
{"666", "6 ", "6 ", "6666", "6 6", "6 6", "666"},
{"77777", " 7", " 7", " 7 ", "7 ", "7 ", "7 "},
{"888", "8 8", "8 8", "888", "8 8", "8 8", "888"},
{"9999", "9 9", "9 9", "9999", " 9", " 9", " 9"},
}
Test.ext 123
******************
1 222 333
11 2 2) 3 3
1 2 3
1 2 33
1 2 3
1 2 3 3
111 22222 333
******************