使用c語言對數據進行加密,具體方法如下:
#include
void main()
{
int a[5];
int num, temp, encripy;
int i;
do
{
printf("Please input the number:");
scanf("%d",&num);
if(!(num/10000 !=0 && num/100000==0))
printf("Data error!\n");
}while(!(num/10000 !=0 && num/100000==0));
a[0] = num/10000%10;
a[1] = num/1000%10;
a[2] = num/100%10;
a[3] = num/10%10;
a[4] = num%10;
for(i = 0; i < 5; ++i)
a[i] = (a[i] + 8)%10;
temp = a[0];
a[0] = a[3];
a[3] = temp;
temp = a[1];
a[1] = a[2];
a[2] = temp;
encripy = a[0]*10000 + a[1]*1000 + a[2]*100 + a[3]*10 + a[4];
printf("\nThe scourse number: %d\n", num);
printf("\nEncripy the number: %d\n\n", encripy);
}