using namespace std;void handleCase1(int *key, int value){ cout<<"key="<<*key<<"--value="<<value<<endl; *key = 0; cout<<"handleCase1="<<*key<<endl;}void handleCase2(int *key, int value){ cout<<"key="<<*key<<"--value="<<value<<endl; *key = 0; cout<<"handleCase2="<<*key<<endl;}void handleCase3(int *key, int value){ cout<<"key="<<*key<<"--value="<<value<<endl; *key = 0; cout<<"handleCase3="<<*key<<endl;}void handleCase4(int *key, int value){ cout<<"key="<<*key<<"--value="<<value<<endl; *key = 0; cout<<"handleCase4="<<*key<<endl;}void (*af[])(int*, int)={ handleCase1, handleCase2, handleCase3, handleCase4};
#include <iostream>#include "stdio.h"#include <iomanip>#include "include.h"using namespace std;int type = 0;int i = 0;int main(void){ for (i = 0; i < 4; i++) { type=10+i*10; (*af[i])(&type, type); } cout<<"Done!"<<endl; getchar(); getchar();}