//keep it simple and stupid
#include<stdio.h>
int main(){
int n=25;
printf("%03d\n",n);
printf("%.3f\n",n);
return 0
}
025
25.000
请按任意键继续. . .
int x_2(int t) {
return t*t;
}
int main() {
printf("%d\n", 0x80000000);
printf("%d\n", 0x7fffffff);
printf("%d\n", x_2(11111));
printf("%d\n", x_2(111111));
printf("%d\n", x_2(1111111));
printf("%d\n", x_2(11111111));
/*
-2147483648
2147483647
123454321
-539247567
1912040369
-2047269199
*/
system("pause");
return 0;
}
int中最大 0x7fffffff 最小0x80000000(正负20亿)
考虑浮点误差。int m=floor(sqrt(n)+0.5);
%lld ->long long(linux 中)
%I64d ->long long (windows)
const int MAX = 1e9;
const long long Big = 1e18;
int main() {
printf("%I32d\n", MAX);// 1000000000
printf("%I64d\n", Big);//1000000000000000000
system("pause");
return 0;
}
1e9是浮点数,所以当有printf("%I32d\n", 1e3);//输出 0
64位大概就是18位十进制数(有符号的)。
1e-3 ->0.001
要计算只含有 加减乘 式子对数字N的模,可以在每一次结果后面取模,和最后一次计算结果一样
scanf_s返回成功读入的个数