动态执行!
程序代码:
#include <stdio.h> #include <stdlib.h> typedef void (*types)(void); void counter(int a, int b, int c, types vd[3]); void printx(void); void printy(void); void printj(void); int main(void) { types pp[3]={printx,printy,printj}; int x,y,j; scanf("%d,%d,%d",&x,&y,&j); counter(x,y,j,pp); system("pause"); return 0; } void counter(int a, int b, int c, types vd[3]) { vd[a](); vd[b](); vd[c](); } void printx(void) { printf("XXXXXXXXXXXXXXXXXXXX\n"); } void printy(void) { printf("YYYYYYYYYYYYYYYYYYYY\n"); } void printj(void) { printf("JJJJJJJJJJJJJJJJJJJJ\n"); }
[[italic] 本帖最后由 ioriliao 于 2008-1-1 20:40 编辑 [/italic]]