我编的,不怎么好,大家不要笑哦。。。。
#include"stdio.h"
#include"stdlib.h"
#include"conio.h"
void main()
{
int king,queen;
long sum=0,SUM=0;
int i,j;
int *p,*q;
printf("please input your data:");
scanf("%d",&king);
if(king==0)
{
printf("can't check it....");
getchar();
getch();
exit(0);
}
if(king<0)
king=0-king;
queen=king;
for(i=1;i<99;i++)
{
if(king/=10)
continue;
else
break;
}
king=queen;
p=(int *)calloc(i,sizeof(int));
q=p;
for(j=0;j<i;j++)
{
*p=king%10;
sum=(*p)*(*p)*(*p);
printf("%d*%d*%d=%d\n",*p,*p,*p,sum);
SUM+=sum;
king/=10;
p++;
}
free(q);
if(SUM==queen)
printf("\nYES!\nThis is a daffofil data!\n\n");
else
printf("\nNO!\nThat's not a daffofil data!\n\n");
}