wolf님 감사감사.. 근데 제가 c 를 몰라서.. ;;
델파이 코드는 안될까용? ;;
======================================================
BloodWolf 님이 쓰신 글 :
: //---------------------------------------------------------------------------
: #include <iostream>
: #include <string>
: #include <map>
: #pragma hdrstop
:
: typedef void (*FUNC_PTR)(void);
: typedef std::map<std::string,FUNC_PTR> FUNC_MAP;
:
: void foo(void)
: {
: std::cout << "call function 'foo'" << std::endl;
: }
: //---------------------------------------------------------------------------
:
: void bar(void)
: {
: std::cout << "call function 'bar'" << std::endl;
: }
: //---------------------------------------------------------------------------
:
: #pragma argsused
: int main(int argc, char* argv[])
: {
: FUNC_MAP func_map;
: func_map["foo"]=&foo;
: func_map["bar"]=&bar;
:
: std::string input;
: std::cout << "input function name: ";
: std::cin >> input;
:
: FUNC_MAP::iterator iterator=func_map.find(input);
: if(iterator!=func_map.end())
: {
: (iterator->second)();
: } else
: {
: std::cout << "can't find function '" << input << "'" << std::endl;
: }
:
: return 0;
: }
: //---------------------------------------------------------------------------
|