标签:return std secure crt 一个 can == val value
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
int compare(int x, int y)
{
int px = x;
int py = y;
int count = 0;
int i = 0;
for (i = 0; i < 32; i++)
{
if (1 == ((px & 1) ^ (py & 1)))
{
count++;
}
px >>= 1;
py >>= 1;
}
return count;
}
int main()
{
int tmp1 = 0;
int tmp2 = 0;
int value = 0;
printf("请输入第一个数字:>");
scanf("%d", &tmp1);
printf("\n");
printf("请输入第二个数字:>");
scanf("%d", &tmp2);
printf("\n");
value = compare(tmp1, tmp2);
printf("一共有%d位不同\n", value);
return 0;
}
标签:return std secure crt 一个 can == val value
原文地址:http://www.cnblogs.com/shy0322/p/7614720.html