这个问题是判断对称数。我输入的数字到下面的IF函数时突然就变了,这个是什么问题呢?
#include <stdio.h>
#include<math.h>
int main() {
int i;
scanf("%d",&i);//输入123456
int h;
h=i;
int bit=(int)log10(i)+1;
int a=10,b=0,c=0,d=1,total=0;
while (i)
{
b=i%a;
double d = pow(10, bit-1);
c=b*d;
total+=c;
bit-=1;
i=i/a;
}
if (h=total)//我在调试代码的时候,上一步还是123456(这个是假),但下一步就变成了654321(就为真了)
{
printf("yes\n");
}else{
printf("no\n");
}
return 0;
}
if (h=total)
->
if (h==total)/
这是为什么呢
int days(struct date day) {
//这里首先定义一个关于闰年和非闰年每一个月天数的二维数组
const int month_days[2][13] = {{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, //非闰年每一个月的天数
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}}; //闰年每一个月的天数
int i, lp=0;
if(day.year%4 == 0 && day.year %100!=0 || day.year%400 == 0) lp=1; //lp用来判断是否闰年
...
}