#include <stdio.h>
#include <windows.h>
void DispArrow(int iPercent)
{
printf("=>");
}
void DispStar(int iPercent)
{
printf("*");
}
void DispMinus(int iPercent)
{
printf("-");
}
void DispPercent(int iPercent)
{
printf("%d%% 작업완료\n",iPercent);
}
int MyFunc(void (* DispFunc)(int))
{
int iTotal = 0;
int i;
for (i = 0;i < 10;++i)
{
DispFunc((i+1)*10);
iTotal = iTotal + i;
Sleep(1000);
}
return iTotal;
}
void main()
{
void (* DispFunc)(int);
int iChoice;
printf("선택 : ");
scanf("%d",&iChoice);
switch (iChoice)
{
case 1:
DispFunc = DispArrow;
break;
case 2:
DispFunc = DispStar;
break;
case 3:
DispFunc = DispPercent;
break;
}
int iResult = MyFunc(DispFunc);
printf("iResult => %d\n",iResult);
}
'Study' 카테고리의 다른 글
double linked list (0) | 2008.12.16 |
---|---|
malloc 사용 예 (0) | 2008.12.16 |
gray code & binary code (0) | 2008.12.15 |
구조체 할당 크기 (0) | 2008.12.15 |
C 언어 기초 (0) | 2008.12.14 |