#include <cstdlib>
#include <iostream>
using namespace std;
void (*_main)(int);
void f1(int i)
{
printf("%2d %2d\t",i,i);
}
void f2(int i)
{
printf("%2d %2d\t",i,i*2);
}
void f3(int i)
{
printf("%2d %2d\t",i,i/2);
}
int main(int argc, char *argv[])
{
int i,j,k,ran;
void (*(buffer[10]))(int);
buffer[0] = f1;
buffer[1] = f2;
buffer[2] = f3;
for(i=0;i
{
_main = buffer[i%3];
_main(i);
}
system("pause");
return EXIT_SUCCESS;
}
全站熱搜
留言列表