Created
December 7, 2013 08:12
-
-
Save sndnvaps/7838542 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <vector> | |
#include <map> | |
using namespace std; | |
class table { | |
private: | |
string number; | |
string big_num; | |
public: | |
table(string num) { | |
number = num; | |
} | |
void print_table() { | |
if (atoi(number.c_str()) < 0) { | |
cout << "input number" << number.c_str() << "less then zero" << endl; | |
return; | |
} else if ( 0 < atoi(number.c_str()) < 9) { | |
big_num = number; | |
char bigDigits[10][256] = { | |
{ " 000 \n" | |
"0 0 \n" | |
"0 0 \n" | |
"0 0 \n" | |
" 0 0 \n" | |
" 000 \n"}, | |
{" 11 \n" | |
" 11 \n" | |
" 11 \n" | |
" 11 \n" | |
" 11 \n" | |
" 11 \n"}, | |
{" 222 \n" | |
" 2 2 \n" | |
" 2 \n" | |
" 2 \n" | |
" 2 \n" | |
" 2222 \n"}, | |
{" 333 \n" | |
" 3 \n" | |
" 333 \n" | |
" 3 \n" | |
" 333 \n" | |
" \n"}, | |
{" 4 \n" | |
" 4 4 \n" | |
" 4 4 \n" | |
" 44444 \n" | |
" 4 \n" | |
" 4 \n"}, | |
{" 5555 \n" | |
" 5 \n" | |
" 555 \n" | |
" 5 \n" | |
" 5 \n" | |
" 555 \n"}, | |
{" 6 \n" | |
" 6 \n" | |
" 6666 \n" | |
" 6 6 \n" | |
" 6 6 \n" | |
" 666 \n"}, | |
{" 77777 \n" | |
" 7 \n" | |
" 7 \n" | |
" 7 \n" | |
" 7 \n" | |
" 7 \n"}, | |
{" 8 \n" | |
" 8 8 \n" | |
" 8 \n" | |
" 8 8 \n" | |
" 8 \n" | |
" \n"}, | |
{" 9999 \n" | |
" 9 9 \n" | |
" 9999 \n" | |
" 9 \n" | |
" 9 \n" | |
" 9 \n"}, | |
}; | |
int i = 0; | |
int j = 0; | |
j = atoi(big_num.c_str()); | |
for (int p = 0; p < 9; p++) { | |
char *table = bigDigits[p]; | |
if (j == p) { | |
cout << table << endl; | |
} | |
} | |
} | |
} | |
}; | |
int main(int argc, char *argv[]) { | |
if (argc < 2) { | |
cout << "big-number number " << endl; | |
} else { | |
table t(argv[1]); | |
//table t("0"); | |
t.print_table(); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
只能说,这个方法很二。