느낀 ¶
가 길 보만 기 stack라는 래.. LittleAOI 만들 2나 던 래다.
꾸 려먹는뭐.,ㅎㅎㅎ 로 기 귀고.ㅎ
가 로그래머 라고나 까..ㅎㅎㅎ
뭐.. 문 놨까 '만'라고 만.. 닷..ㅠ.ㅜ 문 고..ㅠ.ㅜ
꾸 려먹는뭐.,ㅎㅎㅎ 로 기 귀고.ㅎ
가 로그래머 라고나 까..ㅎㅎㅎ
뭐.. 문 놨까 '만'라고 만.. 닷..ㅠ.ㅜ 문 고..ㅠ.ㅜ
¶
~cpp #include <iostream> using namespace std; const bool TRUE=1; const bool FALSE=0; const int MAX_LONG=5;//대가 5리 기때문. const int MAX_NUMBER=10000;//대가 10000기때문. class stack { private: char *data_p; int where_is_save; int max_size_of_stack; public: stack( int data_size ) { data_p=(char*)malloc(data_size*sizeof(char)); max_size_of_stack=data_size; where_is_save=0; } ~stack() { free(data_p); } bool get_in(char save_data) { if (where_is_save != max_size_of_stack) { *(data_p+where_is_save)=save_data; ++where_is_save; return TRUE; } else return FALSE; } bool get_out(char *where_save_p ) { if (where_is_save) { --where_is_save; *where_save_p=*(data_p+where_is_save); return TRUE; } return FALSE; } void clear_data() { where_is_save=0; } }; void main() { // 기 const char NUMBER_TO_HAN[10][3]={"","","","","","","","","","구"}; const char NUMBER_TO_JARI[5][3]={"","","","","만"}; stack print_number(MAX_LONG); int input_number=-1; char jari=-1; //력 while (input_number<0 || input_number>=MAX_NUMBER) { system("CLS"); cout << "력 : "; cin >> input_number; } // while (input_number>0) { print_number.get_in(input_number%10); input_number/=10; ++jari; } //력 cout << "력 : "; char temp; if (jari==-1) cout << NUMBER_TO_HAN[0]; while (print_number.get_out(&temp)) { if (temp!=0) cout << NUMBER_TO_HAN[temp] << NUMBER_TO_JARI [jari]; --jari; } }